Navigate to different screen from a button in a header

后端 未结 2 1830
故里飘歌
故里飘歌 2021-01-17 07:36

I am using the new React-navigation from react-native. I have the navigation as follows:

StackNavigator:

  1. TabNavigator // HomeNavigation
  2. TabNav
2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-17 08:28

    Code that worked for me:

    import Header from '../Containers/Header'
    .........................................
    navigationOptions: ({ navigation }) => ({
          title: 'Find User',
          headerRight: 
    , headerStyle: styles.header })

    And to move to other screen:

    this.props.navigation.navigate('UserDetail', {});
    

提交回复
热议问题