重置堆栈会在堆栈中显示较旧的页面,并在反应导航中显示一秒钟

时间:2017-06-21 16:40:04

标签: reactjs react-native react-navigation

当我在我的SignIn屏幕中并且我将我的堆栈重置为指向主TabNavigator时,我会短暂地看到欢迎屏幕。它看起来并不吸引人。我该如何解决这个问题? 我的路由器中有以下代码:

export const WelcomeStack = StackNavigator({
welcome:{
    screen: WelcomeScreen,
    navigationOptions: {
        header: () => { null }
    }
},
SignIn: {
    screen: SignIn,
    navigationOptions: {
        headerBackTitle: "Tilbake",
        headerTintColor: colors.background,
        headerStyle: {
            marginTop: Platform.OS === 'android' ? 24 : 0,
            backgroundColor: colors.primary
        },
        title: 'SeniorSmart'
    }
},
main: {
    screen: TabNavigator({
        FindEvents: {
            screen: FindEvents,
            navigationOptions: {
                title: 'Finn aktiviteter',
            },
        },
    }, {
        tabBarPosition: 'bottom',
        tabBarComponent: TabBarBottom,
        swipeEnabled: false,
        animationEnabled: true
    }),
}

这是我用来导航到主tabnavigator屏幕的代码:

 const resetAction = NavigationActions.reset({
                        index: 0,
                        actions: [
                            NavigationActions.navigate({ routeName: 'main' }),
                        ],
                    });
                    this.props.navigation.dispatch(resetAction);

0 个答案:

没有答案