gpt4 book ai didi

react-native - TabNavigator 额外填充

转载 作者:行者123 更新时间:2023-12-04 04:04:25 25 4
gpt4 key购买 nike

如何设置 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
},
}
});

enter image description here

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

发现额外的填充是由 View 引起的:
enter image description here

我该如何摆脱它?

最佳答案

通过设置解决:

tabBarOptions: {
labelStyle: {
margin: 0
},
}

关于react-native - TabNavigator 额外填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46814791/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com