将参数从StackNavigator传递到TabNavigator,然后传递到TabNavigator内的StackNavigator

时间:2018-05-13 09:36:54

标签: react-native react-navigation

我使用StackNavigator实现了Splash Screen。从中我导航到TabNavigator,其中每个Tabs包含一个StackNavigator。如何将Splash屏幕中的参数传递给TabNavigator StackNavigators中的组件

const resetAction = NavigationActions.reset({
            index: 0,
            actions: [
              {
                type: 'Navigation/INIT',
                routeName: 'TabScreen',
                params: {
                  userLocation
                }
              }
            ]
          })
          this.props.navigation.dispatch(resetAction);

TabNavigator的

const InformationStack = StackNavigator({
  Information: { screen: Information },
});

const TabScreen = TabNavigator(
  {
    Information: { screen: InformationStack }
  },

我无法访问信息中的参数。有人请帮忙

params: { userLocation }

0 个答案:

没有答案