有没有办法让 StackNavigator 无法导航回页面?
Is there a way to make unable to navigate back to page in StackNavigator?
我在使用导航的 React-Native js 框架开发应用程序时遇到了这个问题。我有一个 StackNavigator,它可以在登录页面和主页之间导航。但我不想让用户导航回登录页面,当他点击 phone 按钮,或通过屏幕栏上的按钮导航时,没有注销
有没有办法拒绝 StackNavigator 导航回登录页面?
如果我没理解错的话,一旦您确定登录成功,您需要做的就是通过 Reset Navigation Action.
重置堆栈
import { NavigationActions } from 'react-navigation'
const resetAction = NavigationActions.reset({
index: 0,
actions: [
NavigationActions.navigate({ routeName: 'Profile'})
]
})
this.props.navigation.dispatch(resetAction)
用你的路线名称,我认为这是家或类似的东西。
如果你想通过重置整个事情回到注销状态,你会 to pass null to the key param。
我在使用导航的 React-Native js 框架开发应用程序时遇到了这个问题。我有一个 StackNavigator,它可以在登录页面和主页之间导航。但我不想让用户导航回登录页面,当他点击 phone 按钮,或通过屏幕栏上的按钮导航时,没有注销
有没有办法拒绝 StackNavigator 导航回登录页面?
如果我没理解错的话,一旦您确定登录成功,您需要做的就是通过 Reset Navigation Action.
重置堆栈import { NavigationActions } from 'react-navigation'
const resetAction = NavigationActions.reset({
index: 0,
actions: [
NavigationActions.navigate({ routeName: 'Profile'})
]
})
this.props.navigation.dispatch(resetAction)
用你的路线名称,我认为这是家或类似的东西。
如果你想通过重置整个事情回到注销状态,你会 to pass null to the key param。