我有3层StackNavigator
第一层
const RootNavigator = createStackNavigator(
{
Main: MainNavigator,
[Screens.Result]: ResultModal,
},
{
mode: 'modal',
headerMode: 'none',
transparentCard: true,
initialRouteName: 'Main',
},
第二层
const MainNavigator = createStackNavigator(
{
[Screens.Landing]: LandingScreen,
Feature: FeatureNavigator,
},
{
mode: 'card',
headerMode: 'none',
initialRouteName: Screens.Landing,
},
)
第三层
const FeatureNavigator = createStackNavigator(
{
[Screens.Payout]: PayoutScreen,
},
{
mode: 'card',
initialRouteName: Screens.Payout,
},
)
在PayoutScreen
中有
this.props.navigation.navigate('Result', {test: '123'}
然后,当我监视Reactotron中的导航道具时,navigation.state.params等于undefined。奇怪的是,我使用相同的方法将参数从LandingScreen
传递到PayoutScreen
,这是可行的。
情态有什么不同吗?