gpt4 book ai didi

react-native - 在 React Native 中更改 React 导航选项卡的底部栏容器颜色

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

我正在尝试将边框半径添加到底部栏,但是有了这个
我想将容器颜色从默认更改为紫色。

我怎样才能做到这一点 ?

到目前为止我做了什么

enter image description here

我要什么

enter image description here

代码:

tabBarOptions: {
activeTintColor: colors.primary,
inactiveTintColor: colors.black,
showLabel: false,
style: {
borderWidth: 0.5,
borderBottomWidth: 1,
backgroundColor: 'white',
borderTopLeftRadius: 20,
borderTopRightRadius: 20,
borderColor: colors.lightGrayText,
},
},

任何人都可以帮忙吗?

谢谢

最佳答案

您必须添加一个绝对位置,这将使标签栏保持在边框内

tabBarOptions={{
activeTintColor: 'red',
inactiveTintColor: 'black',
showLabel: false,
style: {
borderWidth: 0.5,
borderBottomWidth: 1,
backgroundColor: 'red',
borderTopLeftRadius: 20,
borderTopRightRadius: 20,
borderColor: 'grey',
position: 'absolute'
},
}}>

引用
https://github.com/react-navigation/react-navigation/issues/5928

关于react-native - 在 React Native 中更改 React 导航选项卡的底部栏容器颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62242349/

24 4 0