Hide labels in TabNavigator - ReactNavigation

不想你离开。 提交于 2019-12-02 00:53:17

TabNavigator has showLabel prop that you can set. For more info please refer to docs for v1 or docs for v2.

showIcon - whether to show icon for tab, default is false

showLabel - whether to show label for tab, default is true

Here is an example of showing Icon without Label.

tabBarOptions: {
  showLabel: false,
  showIcon: true,
  tintColor: '#333',
  activeTintColor: '#aaa',
}

I defined tintColor and activeTintColor for changing active tab's label color.for changing active tab's icon color you need to define tabBarIcon for each tab and pass tintColor to it. for example if you have a search tab you can do it like this:

Search: {
  screen: SearchScreen,
  navigationOptions:{
    tabBarIcon: ({ tintColor }) => (
      <Icon name="ios-search" style={{color:tintColor}} />
    )
  }
},
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!