从底部标签导航隐藏/删除图标或图标视图

时间:2020-06-23 08:43:36

标签: react-native react-native-android react-navigation react-navigation-bottom-tab

我要从“底部”选项卡的导航器中删除图标空间/视图。我试图通过删除tabBarIcon来删除该图标,但是它不起作用。这是我尝试的代码和收到的结果。看起来不太好,标签不在中心。它们看起来好像已经进入可见屏幕的下方。 使用的代码:

@Configuration
public class AppConfig {
    
    @Bean
public List<Record> records(){
    List<Record> records = new ArrayList<Record>();
    records.add(new Record("d"));
    return records;
  }
}

结果:

enter image description here

我是React-Native的新手。请帮助我。

3 个答案:

答案 0 :(得分:0)

将此添加到您的导航代码:

tabBarOptions: {
    showIcon: false
},

参考:React Navigation Documentation

答案 1 :(得分:0)

我今天遇到了同样的问题,但整个互联网都找不到一个解决方案。

幸运的是,我设法通过以下样式解决了该问题:

tabBarOptions={{
  labelStyle: {
    position: 'absolute',
    top: 0,
    bottom: 0,
    left: 0,
    right: 0,
    textAlignVertical: 'center',
  },
}}

答案 2 :(得分:0)

我用下面的 tabBarOptions 解决了这个问题,

tabBarOptions: {
  style: {
    backgroundColor: 'white',
    alignItems: 'center',
  },
  labelStyle: {
    fontSize: 16,
  },
  activeTintColor: '#444444',
  inactiveTintColor: 'lightgrey',
  showIcon: false,
}