用反应导航限制回来
restrict back with react-navigation
我在我的 React Native 应用程序中使用 React-Navigation。切换到另一个屏幕时,我正在使用此命令 this.props.navigation.navigate
例如。 this.props.navigation.navigate('AddGradeLevelScreen')
它运行良好,但如何限制返回到过去的屏幕(phone 的后退按钮)。
尝试重置路由状态并使用 'AddGradeLevelScreen'、
对其进行初始化
import { NavigationActions } from 'react-navigation';
const resetAction = NavigationActions.reset({
index: 0,
actions: [
NavigationActions.navigate({ routeName: 'AddGradeLevelScreen'})
]
});
this.props.navigation.dispatch(resetAction);
我在我的 React Native 应用程序中使用 React-Navigation。切换到另一个屏幕时,我正在使用此命令 this.props.navigation.navigate
例如。 this.props.navigation.navigate('AddGradeLevelScreen')
它运行良好,但如何限制返回到过去的屏幕(phone 的后退按钮)。
尝试重置路由状态并使用 'AddGradeLevelScreen'、
对其进行初始化import { NavigationActions } from 'react-navigation';
const resetAction = NavigationActions.reset({
index: 0,
actions: [
NavigationActions.navigate({ routeName: 'AddGradeLevelScreen'})
]
});
this.props.navigation.dispatch(resetAction);