检测在导航器之间移动的导航动作

时间:2018-07-13 16:06:45

标签: react-native react-navigation

这是我的导航器的定义方式:

const navigatorA = TabNavigator({
    screenA :{screen: navigatorX},
    screenB: {screen: navigatorY},
});

const navigatorX = Stacknavigator({
     home: {screen: home},
      options: {screen: options},
});

const navigatorY = StackNavigator({
     profile: {screen: profile},
     settings :{ screen: settings}
})

我传递了this.props.navigation.navigate({routeName:'profile', params:{user:{thisUser}});之类的参数

当用户从个人资料屏幕导航回到主屏幕时,而不是从用户个人资料屏幕导航至设置屏幕时,我想重置导航参数。

this.props.navigation.setParams({user:nulll});中使用componenWillUnmount不能完成任务,因为即使用户从配置文件导航到设置,它也会重置参数。

我也尝试过使用willBlur事件侦听器,但是它在堆栈导航器和选项卡导航器中不起作用。

0 个答案:

没有答案
相关问题