【问题标题】:How to hide TabBar Text in TabNavigator?如何在 TabNavigator 中隐藏 TabBar 文本?
【发布时间】:2017-09-16 16:20:07
【问题描述】:

我正在使用来自“react-navigation”的 TabNavigator。我想隐藏或删除图标下的文本。

这是 TabNavigator 的一部分。 (我正在使用世博会)

    Camera: {
      screen: CameraScreen,
    },
    Noti: {
      screen: NotificationScreen,
    },
    Menu: {
      screen: MenuStackNavigator,
    },
  },
  {
    navigationOptions: ({ navigation }) => ({
         header: null, <<<
         tabBarIcon: ({ focused }) => {
                     ...
         },
     }),
     header: null, <<<-
     headerMode: 'none',  <<--       
     tabBarComponent: TabBarBottom,
     tabBarPosition: 'bottom',
     animationEnabled: false,
     swipeEnabled: false,
     backBehavior: 'none',

这是CamaraScreen

class CameraScreen extends Component {
  static navigationOptions = {
    title: 'Camera'
  }

【问题讨论】:

  • @johnbeck 如何将图像显示为页脚。上述图像是图标。我需要将图像显示为页脚。请提供您的意见。我是新来的反应本地人。我尝试了一些代码 sn-ps,但它不起作用。请在stackoverflow.com/questions/49064125/… 中更新您的答案

标签: react-native react-navigation


【解决方案1】:

您可以通过为tabBarOptions 对象指定showLabel: false 来隐藏标签:

backBehavior: 'none',
tabBarOptions: {
    showLabel: false
}

【讨论】:

    猜你喜欢
    • 2018-06-05
    • 1970-01-01
    • 2021-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-17
    • 1970-01-01
    • 2021-03-21
    相关资源
    最近更新 更多