React Native 2导航选项

时间:2018-04-15 16:27:19

标签: react-native

我遇到了' react-navigation'在RN。 在我的应用程序中,我有DrawerNavigator和StackNavigator。 我在StackNavigator中的第三个视图。我试图进入第一个视图并更改抽屉导航器中的选项卡。 我尝试制作此活动时的第三个视图中的代码

                           let navigateAction = NavigationActions.reset({
                              index: 0,
                              routeName:'Home',
                              actions: [
                                  NavigationActions.navigate({ routeName: 'Home' })
                              ]
                          });
                          let navigateActionDrawer = NavigationActions.navigate({
                             index: 0,
                             routeName:'Reservations',
                             actions: [
                                 NavigationActions.navigate({ routeName: 'Reservations'}),
                             ]
                         });
                              object.state.navigation.dispatch(navigateAction)
                              object.state.navigation.dispatch(navigateActionDrawer)

我需要做些什么来纠正这个行动?

1 个答案:

答案 0 :(得分:0)

const navigateAction = NavigationActions.reset({
                        index: 0,
                        key: null,
                        actions: [ 
                            NavigationActions.navigate({
                            routeName:'Reservations',
                           }),
                        ],
                      });

试试这个。如果嵌套,则必须重置为父级并传递要导航的操作。