【发布时间】:2020-06-06 17:13:26
【问题描述】:
我是 React Native 的新手,我正在为 TabBar 使用 this 存储库。
我可以更改一些样式吗?默认情况下,气泡背景是蓝色的,我想将其更改为其他颜色。
在node_modules/react-native-fluidbottomnavigation 下的index.js 中,backgroundColor 定义为#4C53DD。
我可以从使用 TabBar 的那一刻开始更改它吗?
这是我的导航栏:
这是我在App.js中的代码:
<TabBar
onPress={tabIndex => {
console.log(tabIndex);
curTab = tabIndex;
}}
values={[
{
title: 'requests',
image: require('./assets/requests.png'),
tintColor: 'red',
},
{
title: 'requests',
image: require('./assets/requests.png'),
tintColor: 'blue',
},
{
title: 'events',
image: require('./assets/events.png'),
default: true,
tintColor: 'green',
},
{
title: 'members',
image: require('./assets/members.png'),
tintColor: 'orange',
},
{
title: 'account',
image: require('./assets/account.png'),
tintColor: 'yellow',
},
]}
/>
此 tintColor 不会更改您在图片中看到的背景颜色。我希望那个蓝色圆圈是另一种颜色。
【问题讨论】:
-
如果你去FluidBottomNavigation for React Native README 页面,有一个如何使用它的例子。在那里,您将看到
TabBar的哪些属性及其支持的项目,其中还有tintColor用于TabBar和可用于更改颜色的项目。无需分叉和更改任何 Github 存储库。当组件更新时你会做什么?你每次都会重新定义你的仓库吗? -
tintColor 改变字体颜色而不是背景颜色
标签: css reactjs react-native node-modules external