我有以下StackNavigator
export const OauthNavigator = StackNavigator({
Login: {
screen: Login,
navigationOptions: {
title: "Login",
headerLeft: null,
},
},
ResetPassword: {
screen: ResetPassword,
navigationOptions: {
title: "Reset Password",
headerLeft: null
},
}
});
然后我有我的主导航
//主导航StackNavigator
export const MainScreenNavigator = StackNavigator({
Home: {
screen: TabsNavigation,
},
Drawer: {
screen: MainDrawerNavigator
}
});
我正在使用redux如何加载不同的
这是我的减速机
const AppReducer = combineReducers({
nav: (state = initialNavState, action) => {
switch(action.type) {
case 'LOGIN':
return AppNavigator.router.getStateForAction(NavigationActions.navigate({ routeName: 'Login' }), state);
case 'LOGOUT':
return AppNavigator.router.getStateForAction(NavigationActions.navigate({ routeName: 'Login' }), state);
case 'RESET_PASSWORD':
return AppNavigator.router.getStateForAction(NavigationActions.navigate({ routeName: 'ResetPassword' }), state);
case 'MAIN':
return AppNavigator.router.getStateForAction(NavigationActions.navigate({ routeName: 'Main' }), state);
case 'TEAM':
return AppNavigator.router.getStateForAction(NavigationActions.navigate({ routeName: 'Teams' }), state);
default:
return AppNavigator.router.getStateForAction(action, state);
}
},