React native CreateBoottomTabNavigator设置选项卡栏高度会导致顶行消失
在我设置高度之前,它看起来是这样的,注意选项卡栏上方有一条线 我像这样更改选项卡栏的高度React native CreateBoottomTabNavigator设置选项卡栏高度会导致顶行消失,react-native,react-navigation,React Native,React Navigation,在我设置高度之前,它看起来是这样的,注意选项卡栏上方有一条线 我像这样更改选项卡栏的高度 { initialRouteName: "Find", tabBarOptions: { activeTintColor: '#0a0a0a', labelStyle: { fontSize: ScreenUtil.scale(14), }, style: { background
{
initialRouteName: "Find",
tabBarOptions: {
activeTintColor: '#0a0a0a',
labelStyle: {
fontSize: ScreenUtil.scale(14),
},
style: {
backgroundColor: '#f7f7f7',
//----------add this line------------------------//
height: 70;
},
}
}
结果是这样的,线现在消失了
如果要更改选项卡栏高度并保留线条,该怎么办?您可以使用自定义选项卡栏,也可以尝试设置边框。 这是显示自定义选项卡栏的示例
export const MainTabNavigator = TabNavigator({
Home: { screen: HomeScreen },
Activity: { screen: ActivityScreen },
Contacts: {screen: ContactsScreen },
More: { screen: MoreScreen }
}, {
tabBarComponent: TXTabBar, // custom tabbar component
tabBarPosition: 'bottom',
});
下面是设置边界的代码
{
initialRouteName: "Find",
tabBarOptions: {
activeTintColor: '#0a0a0a',
labelStyle: {
fontSize: ScreenUtil.scale(14),
},
style: {
backgroundColor: '#f7f7f7',
//----------add this line------------------------//
height: 70;
borderTopWidth: 1,
borderTopColor: 'red'
},
}
}
你用的是什么版本?我现在使用的是2019年7月的最新版本,使用的是高度,上面还有灰色的线条。这对底部标签没有任何影响,有什么想法吗?感谢你的帮助。提前谢谢。