react-navigation

Open one of two drawers from button in react navigation 5

眉间皱痕 提交于 2020-05-17 06:11:27
问题 It was previously possible to open a specific drawer from a button, using getCustomActionCreators , prior to v5 of React Navigation. An example of doing that is here: React Native two drawers on one screen However, it looks like this function has been removed. Is there a way to do this in React Navigation 5? 回答1: This is possible by creating a custom router. Here are a few key pieces of insight: navigators bubble up actions which they don't handle. This means that we need to create a custom

Undefined is not an object 'navigation.navigate' React Native Navigation 5 (NEW)

回眸只為那壹抹淺笑 提交于 2020-05-17 03:55:52
问题 I am doing doing navigation with new react native navigation all I want is when button is pressed it navigate to next screen, I have followed new documentation but the problem is I am doing with classes and in the documentation all the work is done with functions in App.js, I tried to modify my code accordingly but couldn't do with classes as onPress button it does not navigate instead gives me error. This is my app.js: import * as React from 'react'; import { Button, View, Text } from 'react

Undefined is not an object 'navigation.navigate' React Native Navigation 5 (NEW)

蹲街弑〆低调 提交于 2020-05-17 03:54:49
问题 I am doing doing navigation with new react native navigation all I want is when button is pressed it navigate to next screen, I have followed new documentation but the problem is I am doing with classes and in the documentation all the work is done with functions in App.js, I tried to modify my code accordingly but couldn't do with classes as onPress button it does not navigate instead gives me error. This is my app.js: import * as React from 'react'; import { Button, View, Text } from 'react

TypeError: Cannot read property 'measureInWindow' of undefined

筅森魡賤 提交于 2020-05-15 08:12:10
问题 Environment: Windows 10 Node js: 10.x Expo: 35.0.0 React: 16.8 React-native: 0.62.0 React-navigation: 3.0.7 A simple app developed to test navigation on android app, facing the below error: "TypeError: Cannot read property 'measureInWindow' of undefined" Any suggestion would be appreciated. Thank you, 回答1: install react-native-safe-area-view following is the command to install react-native-safe-area-view: npm i react-native-safe-area-view for more info: https://www.npmjs.com/package/react

React-navigation, tintColor is missing in props validation

允我心安 提交于 2020-05-15 04:15:28
问题 I have put my react-navigation code into a separate Routes file which I am then importing into my App.js file. Everything is working fine but I am using Airbnb ESLint config in Atom/Nuclide and getting an error with tintColor... "tintColor is missing in props validation" Tried this: Routes.propTypes = { tintColor: PropTypes.string.isRequired,} But then get error "tintColor PropType is defined but prop is never used" This is part of the code const Routes = () = { const ContentNavigator =

Upgraded to React Native 0.62.0 Getting Warning Sign - "Calling `getNode()` on the ref of Animated component is no longer necessary

你。 提交于 2020-05-14 16:09:11
问题 I just upgrade my react native app to 0.62.0, and now my app keeps getting this warning sign ReactNativeFiberHostComponent: Calling `getNode()` on the ref of an Animated component is no longer necessary. You can now directly use the ref instead. This method will be removed in a future release. I'm not sure why this issue is showing up? Can someone please explain? I also see Stack ref.getNode | createAnimatedComponent.js:129:20 SafeView#_updateMeasurements | index.js:192:14 SafeView

Where is placed createSwitchNavigator in react-navigation 5.x for migrating from react-navigation 4 to 5.x

雨燕双飞 提交于 2020-05-14 12:07:46
问题 I'm migrating a React Native application from react-navigation 4 to 5.x and i can't find which package contains createSwitchNavigation. Specifically i have doubts with the auth token check part. With react-navigation 4 i had: const switchNavigator = createSwitchNavigator({ ResolveAuth: ResolveAuthScreen, signinFlow: createStackNavigator({ Signup: SignupScreen, Signin: SigninScreen, }), appFlow: createBottomTabNavigator({ TrackCreate: TrackCreateScreen, trackListFlow: createStackNavigator({

React-Native, Dynamic ReactNavigation title

此生再无相见时 提交于 2020-05-14 11:42:22
问题 I have a screen that it's title should set from AsyncStorage and many screens are navigating to this screen (so I don't want pass the title everywhere I'm navigating). As navigationOptions is static I'm not able to use this.state and also can't set it's title by reading from AsyncStorage (because AsyncStorage is Async :) How can I change the title inside the screen itself in such a situation? 回答1: You can use setParams navigation action to set the title after async function ends. Example

Pass navigation.navigate to Child Component

自作多情 提交于 2020-05-11 07:09:07
问题 Building an app using react-navigation. I have a parent component that pulls from firebase and renders data in a listview. The listview render component 'ListName' has an onRowPress function but this.props.navigation.navigate comes up undefined because navigation is not in that child component's state. Ive tried multiple ways of passing in navigation prop to the child and also importing navigation from react-navigation within the child. Nothing works. Thanks! Here is my rootStackNavigator:

Pass navigation.navigate to Child Component

女生的网名这么多〃 提交于 2020-05-11 07:07:26
问题 Building an app using react-navigation. I have a parent component that pulls from firebase and renders data in a listview. The listview render component 'ListName' has an onRowPress function but this.props.navigation.navigate comes up undefined because navigation is not in that child component's state. Ive tried multiple ways of passing in navigation prop to the child and also importing navigation from react-navigation within the child. Nothing works. Thanks! Here is my rootStackNavigator: