React Native Navigation StackNavigator在不同的StackNavigator之间加载

时间:2017-07-07 15:21:24

标签: react-native react-redux react-navigation

我有以下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);
        }
    },

0 个答案:

没有答案