How to navigate between different nested stacks in react navigation

后端 未结 14 825
情话喂你
情话喂你 2020-12-02 16:52

The Goal

Using react navigation, navigate from a screen in a navigator to a screen in a different navigator.

More Detail

If I have the following

14条回答
  •  清歌不尽
    2020-12-02 17:26

    React Navigation v3:

    Navigation.navigate now takes one object as the parameter. You set the stack name then navigate to the route within that stack as follows...

    navigation.navigate(NavigationActions.navigate({
        routeName: 'YOUR_STACK',
        action: NavigationActions.navigate({ routeName: 'YOUR_STACK-subRoute' })
    }))
    

    Where 'YOUR_STACK' is whatever your stack is called when you create it...

      YOUR_STACK: createStackNavigator({ subRoute: ... })
    

提交回复
热议问题