更改react native中反应导航选项卡的底部栏容器颜色

问题描述 投票:0回答:1

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

我该怎么做?

到目前为止,我做了什么

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,
      },
    },

任何人都可以帮忙吗?

感谢

react-native react-navigation react-navigation-bottom-tab
1个回答
2
投票

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

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

© www.soinside.com 2019 - 2024. All rights reserved.