TabNavigator额外填充

Som*_*ame 4 tabnavigator react-native react-navigation

如何设置TabNavigator标签的高度和填充样式?我正在执行以下操作:

import Icon from "react-native-vector-icons/MaterialIcons";
const tabNav = TabNavigator({
  TabItem1: {
      screen: MainScreen,
      navigationOptions: {
          tabBarLabel:"Home",
          tabBarIcon: ({ tintColor }) => <Icon name={"home"} size={20} color={tintColor} />
      }
    },
    TabItem2: {
      screen: MainScreen,
      navigationOptions: {
        tabBarLabel:"Home",
        tabBarIcon: ({ tintColor }) => <Icon name={"home"} size={30} color={tintColor}  />
      }
    },
    TabItem3: {
      screen: MainScreen,
      navigationOptions: {
        tabBarLabel:"Browse",
        tabBarIcon: ({ tintColor }) => <Icon name={"home"} color={tintColor} />
      }
    }
}, {
    tabBarPosition: 'bottom',
    tabBarOptions: {
        activeTintColor: '#222',
        activeBackgroundColor :'yellow',  //Doesn't work
        showIcon: true,
        tabStyle: {
            padding: 0, margin:0,   //Padding 0 here
        },
    iconStyle: {
        width: 30,
        height: 30,
        padding:0       //Padding 0 here
    },
    }
});
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

如何摆脱图标和标签之间的空白?我padding:0在里面iconStyle也做了,tabStyle但是没有运气。我也不想在下面填充label。我怎么做?谢谢。

发现额外的填充是由引起的View在此处输入图片说明

我该如何摆脱呢?

Den*_*nis 7

通过设置解决:

tabBarOptions: {
  labelStyle: {
    margin: 0
  },
}
Run Code Online (Sandbox Code Playgroud)


Ram*_*shi 5

尝试style一下tabBarOptions

  tabBarOptions: {
    style: {
      height: 45
    }
  }
Run Code Online (Sandbox Code Playgroud)