【发布时间】:2018-07-16 09:47:16
【问题描述】:
index.js 有类似这样的带有 StackNavigator 的代码
const App = StackNavigator({
Home: {
screen: Home,
},
});
const AppNavigator = StackNavigator(
{
Login: {
screen: SignIn,
},
SignUp: {
screen: SignUp,
},
myApp: { screen: App },
},
{
gestureEnabled: false,
headerMode: 'none',
},
);
我正在登录并推送到 myApp 路由,
this.props.navigation.dispatch(
NavigationActions.reset({
index: 0,
key: null,
actions: [NavigationActions.navigate({ routeName: 'myApp' })]
})
);
所有导航推送和弹出返回工作现在我正在尝试切除那不起作用。
从家里我想去登录屏幕。我正在注销操作
logoutPressed() {
const resetAction = NavigationActions.reset({
index: 0,
actions: [NavigationActions.navigate ({ routeName:
'Login' })],
});
this.props.navigation.dispatch(resetAction);
}
错误:routeName: 'Login' not found in StackNavigator 什么问题。如何解决。
【问题讨论】:
标签: ios reactjs react-native react-navigation react-native-ios