【问题标题】:how to hide tab bar only in home screen?如何仅在主屏幕中隐藏标签栏?
【发布时间】:2019-01-10 22:26:09
【问题描述】:

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

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);

仅在主屏幕中显示标签栏我尝试隐藏在标签栏选项中,但它要么隐藏所有屏幕上的标签栏,要么标签栏在所有屏幕中可见。我应该尝试什么来达到预期的效果?任何帮助表示赞赏。提前谢谢...

【问题讨论】:

  • 如果主屏幕上没有选项卡,如何导航到其他屏幕?
  • @dentemm 主屏幕可以包含以编程方式导航的按钮
  • 我有 4 个按钮用于从主视图导航

标签: react-native react-navigation expo


【解决方案1】:

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

【讨论】:

  • 它有效,但不是用背景图像填充该区域,而是在标签栏的位置显示白色背景
猜你喜欢
  • 1970-01-01
  • 2021-06-01
  • 2021-08-30
  • 2020-01-10
  • 1970-01-01
  • 2013-09-21
  • 2011-11-28
  • 2018-10-15
  • 1970-01-01
相关资源
最近更新 更多