如何仅在主屏幕中隐藏标签栏?

时间:2019-01-10 12:39:58

标签: react-native react-navigation expo

我只想在第一个屏幕上隐藏标签栏,并在其他屏幕上显示,我该如何实现。任何帮助表示赞赏

const TabNavigator = createBottomTabNavigator({
  Home: {
    screen: HomeScreen,
    navigationOptions: {
      tabBarLabel: 'Home',
      tabBarIcon: ({ tintColor }) => (
      <Icon name="ios-home" color={tintColor} size={24} />
      )
    }
  },
Quotes: {
screen: QuoteScreen,
navigationOptions: {
  tabBarLabel: 'Quotes',
  tabBarIcon: ({ tintColor }) => (
  <Icon name="ios-quote" color={tintColor} size={24} />
  )
}
  },
   About: {
    screen: AboutScreen,
    navigationOptions: {
      tabBarLabel: 'About',
      tabBarIcon: ({ tintColor }) => (
      <Icon name="ios-person" color={tintColor} size={24} />
      )
    }
 },
  Books: {
    screen: BoookScreen,
    navigationOptions: {
      tabBarLabel: 'Books',
      tabBarIcon: ({ tintColor }) => (
      <Icon name="ios-book" color={tintColor} size={24} />
      )
    }
  },
  Videos: {
    screen: VideoScreen,
    navigationOptions: {
      tabBarLabel: 'Videos',
      tabBarIcon: ({ tintColor }) => (
      <Icon name="ios-videocam" color={tintColor} size={24} />
      )
    }
  }

},
{
  tabBarOptions: {

    activeTintColor: 'yellow',
    inactiveTintColr: 'white',
    activeBackgroundColor:'black',
    inactiveBackgroundColor:'black'


  }
});

export default createAppContainer(TabNavigator);

仅在主屏幕上显示选项卡栏,我尝试了在选项卡栏选项中隐藏,但是它要么在所有屏幕上隐藏了选项卡栏,要么在所有屏幕上都可见了选项卡栏。我应如何尝试实现所需的结果?任何帮助表示赞赏。预先感谢...

1 个答案:

答案 0 :(得分:1)

tabBarVisible: false,添加到主屏幕导航选项