TabNavigator中的TabNavigator

时间:2017-08-23 23:20:18

标签: reactjs react-native react-navigation

使用react-native和react-navigation,如何将其中一个标签添加为TabNavigator,但其方式是覆盖现有标签?

以下是我想要的导航配置的概要。 但是,“AddNavigator”显示为现有选项卡顶部的选项卡。但我希望他们掩盖这些标签。

export const AddNavigator = TabNavigator({
  AddPhoto: { screen: AddPhoto },
  AddText: { screen: AddText },
}, { mode: 'modal', headerMode: 'none' });

export const Tabs = TabNavigator({
  TabHome: { screen: TabHome },
  TabAdd: { screen: AddNavigator },
  TabProfile: { screen: TabProfile }
});

export const Root = StackNavigator({
  SplashScreen: { screen: SplashScreen },
  LoginScreen: { screen: LoginScreen },
  SignupScreen: { screen: SignupScreen },

  Tabs: { screen: Tabs },

}, { mode: 'modal', headerMode: 'none' });

作为参考,请考虑Instagram应用程序。 当您单击中间的选项卡(添加照片)时,您将获得一个额外的选项卡导航器,要求选择“图库,照片或视频” Screenshot

1 个答案:

答案 0 :(得分:1)

要模拟您对instagram的引用,您可以这样做:

export const Tabs = TabNavigator({
    TabHome: { screen: TabHome },
    TabAdd: {
        screen: AddNavigator,
        navigationOptions: {
            tabBarVisible: false
        }
    },
    TabProfile: { screen: TabProfile }
});

enter image description here