react-navigation

Jest snapshot test failing due to react navigation generated key

与世无争的帅哥 提交于 2019-12-14 03:52:34
问题 My Jest test is failing because of the timestamp in the key being different every time the test is run: FAIL ./App.test.js ✕ renders without crashing (72ms) ● renders without crashing expect(value).toMatchSnapshot() Received value does not match stored snapshot 1. - Snapshot + Received @@ -347,11 +347,11 @@ "index": 0, "isTransitioning": false, "key": "StackRouterRoot", "routes": Array [ Object { - "key": "id-1519567169760-0", + "key": "id-1519567814666-0", "routeName": "Menu", }, ], }, }

Swiping between tabs using createMaterialBottomTabNavigator for android

…衆ロ難τιáo~ 提交于 2019-12-14 02:12:13
问题 I have used React Navigation's createMaterialBottomTabNavigator to create a bottom tab navigator in my app. I want the screens to "slide" in from the left or right when the tab is changed, and swiping on the screen to be able to change tabs. I've looked into the documentation https://reactnavigation.org/docs/en/material-bottom-tab-navigator.html, and I can't find any configuration options that would make this happen. Why is this? 回答1: Solution You can use createMaterialTopTabNavigator instead

How to add react-navigation module to reactive app?

心不动则不痛 提交于 2019-12-13 20:09:26
问题 I've installed the react-navigation module inside the project's folder: ~/react-tutorial/react-native/Project1$ npm install --save react-navigation npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) react-navigation@3.3.2 added 22 packages from 10 contributors and audited 103279 packages in 43

react-native-firebase unable to handle notification click_action to navigate to notification screen

瘦欲@ 提交于 2019-12-13 16:50:24
问题 i'm using this react-native-firebase and react-navigation for navigating and i can push notification from server or console successfully whether its in foreground or background but i swear the documentation is not pretty clear how to open notification and navigate to the notification screen it belongs to. these are my onMessage codes. firebase.messaging().onMessage((payload) => { if(!payload.opened_from_tray){ firebase.messaging().createLocalNotification({ title: payload.title, body: payload

The component for route “Feed” must be a React Component

余生长醉 提交于 2019-12-13 16:15:51
问题 i am trying to understand reactnavigation and i am setting up a concept app to understand. What i am struggling at first is, that i get the Error Message "The component for route "SomeRoute" must be a React Component" I do know, what it means, but i do not understand why this error is thrown. I have following setup: App.js: import React from 'react'; import { Root } from './config/router'; import { SafeArea } from 'react-native'; class App extends Component { render() { return <Root />; } }

How To Reload View Tap on TabNavigator in React Native

半世苍凉 提交于 2019-12-13 15:09:31
问题 I want to reload the tabNavigator when the user changse the tab each time. the lifecycle method of react native doesn't get called when user changes the tab. Then how can it be possible to reload tab in TabNavigator : The below example have two Tabs : 1) Home 2)Events. Now I want to refresh the event Tab when user returns from the home tab. EXPO LINK : Expo Tab Navigator Code : import React, {Component} from 'react'; import {View, StyleSheet, Image, FlatList, ScrollView, Dimensions } from

React Navigation: Dynamically setting `mode` setting (/ header renders double and back button disappears)

佐手、 提交于 2019-12-13 14:32:33
问题 In my app I have three screens: ScreenA , ScreenB and ScreenC . They all should have a header and they should all have a back button with the name of the previous screen. I wanted ScreenA to be able to open ScreenB using the modal animation: const ModalStack = createStackNavigator( { ScreenA, ScreenB }, { initialRouteName: "ScreenA", mode: "modal" } ); And ScreenA should also be able to open ScreenC using the default sliding animation from right to left. The problem was, that the

React Navigation - cannot read property 'navigate' of undefined

谁说我不能喝 提交于 2019-12-13 13:56:08
问题 I've been trying to get up and running with react navigation but I run into a problem when I try to move navigation items into their own components. HomeScreen.js import React, { Component } from 'react'; import { StyleSheet, View, Text } from 'react-native'; import NavButton from '../components/NavButton' class HomeScreen extends Component { render() { return ( <View style={styles.container}> <Text> Hello World </Text> <NavButton navigate={this.props.navigator} /> </View> ); } } const styles

React-navigation contentComponent is not working

心不动则不痛 提交于 2019-12-13 08:38:04
问题 I am trying to customize drawer navigator in my app. I am using react-navigation. When first time I've inserted this code it showed just white screen and even navigation links were disappeared after making few things it showed this error screen. Before that it showed just white screen inside drawer without my links. Here is the code. App.js import React from 'react'; import {StyleSheet, Text, View } from 'react-native'; import WelcomeScreen from './screens/WelcomeScreen'; import SigninScreen

Access Component state inside NavigationOptions - React Native

早过忘川 提交于 2019-12-13 03:54:42
问题 I was trying to conditionally render HeaderLeft by state value, I cant able to access state value inside NavigationOptions static navigationOptions = ({ navigation }) => ({ headerLeft: (navigation.state.searchText)? <View style={{ flexDirection: 'row', justifyContent: 'center' }}> <TouchableOpacity onPress={() => { // navigation.navigate('home'); alert('Coming soon '); }}> <Image style={{ marginLeft: 20,height:20,width:20,resizeMode:"contain" }} source={require('../assets/header_icons/three