[英]How to change the background color of selected bottom tab in react native navigation
I am using react native navigation v2 for by application.我正在按应用程序使用 react native navigation v2。 I need to change the background color of the selected bottom tab.我需要更改所选底部选项卡的背景颜色。
options: {
bottomTab: {
icon: val.icon,
text: val.text,
textColor: getColorTheme("SECONDARY", "LIGHT"),
selectedTextColor: getColorTheme("ORANGE", "LIGHT"),
selectedIconColor: getColorTheme("ORANGE", "LIGHT"),
fontFamily: FONTFAMILY.SEMIBOLD,
fontSize: FONTSIZE.FONT_12,
selectedFontSize: FONTSIZE.FONT_12,
selectedBackgroundColor:'red'
}
}
as @yeslamFaded it could be a good idea to use a newer version of react-navigation.正如@yeslamFaded 一样,使用更新版本的 react-navigation 可能是个好主意。
if you want to change the background color of the selected tab you can use the activeBackgroundColor
prop of tabBarOptions
when you are creating the bottom tab navigator如果要更改所选选项卡的背景颜色,可以在创建底部选项卡导航器时使用activeBackgroundColor
的tabBarOptions
for instance:例如:
export default createBottomTabNavigator(
{
Home: HomeScreen,
Settings: SettingsScreen,
},
{
tabBarOptions: {
activeBackgroundColor: 'tomato',
},
}
);
All the properties are available in the documentation here所有属性都在此处的文档中可用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.