在MaterialBottomTabNavigator中隐藏屏幕(反应导航)

时间:2018-10-07 13:20:50

标签: react-native react-navigation

我用React Navigation创建了一个MaterialBottomTabNavigator。但是有些屏幕我不想显示在选项卡栏中,但仍然希望能够导航到这些屏幕。因此,我该如何注册未显示在栏中的屏幕(在屏幕截图中:我想通过一个屏幕中的按钮导航至选项卡中的第三个屏幕-因此不应将其显示在栏中) 。

const RootStack = createMaterialBottomTabNavigator(
  {
    Home: {
            screen: Home,
            navigationOptions: ({ navigation }) => ({
                title: 'Home',
        tabBarIcon: ({ tintColor, focused }) => (
          <Icon size={30} name={ Platform.OS === 'ios' ? (focused ? 'ios-home' : 'ios-home-outline') : 'md-home' } style={{ color: tintColor }} />
        )
            })
        },
    Detail: {
      screen: Detail,
            navigationOptions: ({ navigation }) => ({
                title: 'Detail',
        tabBarIcon: ({ tintColor, focused }) => (
          <Icon size={30} name={ Platform.OS === 'ios' ? (focused ? 'ios-settings' : 'ios-settings-outline') : 'md-settings' } style={{ color: tintColor }} />
        )
            })
    },
    New: {
      screen: New,
            navigationOptions: ({ navigation }) => ({
                title: 'New',
        hidden: true
            })
    }
  },
  {
    initialRouteName: 'Home',
    activeColor: '#f0edf6',
    inactiveColor: '#3e2465',
    barStyle: { backgroundColor: '#694fad' },
    labeled: false
  }
);

Screenshot of the created Navigation Bar

0 个答案:

没有答案