React native:底部标签导航器消失了

时间:2019-03-19 23:28:04

标签: react-navigation

我有一个小问题,我有2种导航:一种是 stackNavigator ,另一种是bottomTabNavigator。

这是代码:

const Tab = createBottomTabNavigator(
    {
        Home: {
            screen: HomeScreen,
        },

        Search: {
            screen: SearchScreen
        },

        Settings: {
            screen: SettingsScreen
        },
    },
    {
        tabBarOptions: {
            showLabel: false,
        },
    }
);

和stackNavigator:

const ScreenNavigator = createStackNavigator({
        Home: {
             screen: HomeScreen
        },

        Search: {
            screen: SearchScreen
        },

        Settings: {
           screen: SettingsScreen
        },

        PollScreen: {
            screen: PollScreen
        },

        PollPrivacy: {
            screen: PollPrivacy
        }

    }
);

然后,我使用功能 createSwitchNavigator 在导航之间切换,最后,我具有 createAppContainer

const switchNav = createSwitchNavigator({StartPageNavigator, Tab, ScreenNavigator}, {resetOnBlur: false, backBehavior: "none"});
const Navigator = createAppContainer(switchNav);

(哦,StartPageNavigator是另一个stackNavigator,但是没关系) 如您所见,我在stackNavigator中显示了“ PollPrivacy”屏幕,但在bottomtabnavigator中却没有。现在,如果我“调用”主屏幕中某个组件上的 longPress 函数,则会得到一个 ActionSheetIOS ,然后单击“ 隐私按钮”。在ActionSheet上,然后进入PollPrivacy屏幕。和所有的作品。现在,当我进入PollPrivacy屏幕时,看不到bottomTabNavigator(可以),并且在标题中有经典的“后退按钮” 。在此屏幕中,我拥有:

static navigationOptions = ({navigation}) => ({
    title: "Poll privacy",
    headerLeft: <HeaderBackButton onPress={() => navigation.goBack(null)}/>,
});

并且可以使用,但是当我返回时,看不到bottomTabNavigator, 它消失了。我不知道为什么。有人可以给我一个主意吗?

谢谢!

0 个答案:

没有答案