Reactjs activeTintColor不更改反应导航中的图标颜色 HomeStack.navigationOptions={ tabBarLabel:“主页”, tabBarIcon:({focused})=>( ), 选项卡选项:{ activeTintColor:“#cd077d”, }, };
我正在尝试更改我的TabBarIcon的颜色我尝试了ActiveTintColor,但这似乎只是更改了文本颜色,而不是图标颜色,激活时它当前是默认的蓝色 试试这个Reactjs activeTintColor不更改反应导航中的图标颜色 HomeStack.navigationOptions={ tabBarLabel:“主页”, tabBarIcon:({focused})=>( ), 选项卡选项:{ activeTintColor:“#cd077d”, }, };,reactjs,react-native,react-navigation,Reactjs,React Native,React Navigation,我正在尝试更改我的TabBarIcon的颜色我尝试了ActiveTintColor,但这似乎只是更改了文本颜色,而不是图标颜色,激活时它当前是默认的蓝色 试试这个 HomeStack.navigationOptions = { tabBarLabel: 'Home', tabBarIcon: ({ focused }) => ( <TabBarIcon focused={focused} name
HomeStack.navigationOptions = {
tabBarLabel: 'Home',
tabBarIcon: ({ focused }) => (
<TabBarIcon
focused={focused}
name={Platform.OS === 'ios' ? 'ios-home' : 'md-home'}
/>
),
tabBarOptions: {
activeTintColor: '#cd077d',
},
};
HomeStack.navigationOptions={
tabBarLabel:“主页”,
tabBarIcon:({focused,tintColor})=>(
),
选项卡选项:{
activeTintColor:“#cd077d”,
},
};
您不能设置返回的TabBarIcon组件的颜色吗?看看官方文件中的颜色:
导出默认CreateBoottomTabNavigator(
{
主页:主屏幕,
设置:设置屏幕,
},
{
defaultNavigationOptions:({navigation})=>({
tabBarIcon:({聚焦、水平、着色})=>{
返回;
},
}),
选项卡选项:{
activeTintColor:‘番茄’,
颜色:“灰色”,
},
}
);
在react导航版本:5.x中
}}
/>
TrytabBarIcon:({focused,tintColor})
HomeStack.navigationOptions = {
tabBarLabel: 'Home',
tabBarIcon: ({focused, tintColor }) => (
<TabBarIcon
focused={focused}
name={Platform.OS === 'ios' ? 'ios-home' : 'md-home'}
tintColor={{ tintColor }}
/>
),
tabBarOptions: {
activeTintColor: '#cd077d',
},
};
export default createBottomTabNavigator(
{
Home: HomeScreen,
Settings: SettingsScreen,
},
{
defaultNavigationOptions: ({ navigation }) => ({
tabBarIcon: ({ focused, horizontal, tintColor }) => {
return <IconComponent name={iconName} size={25} color={tintColor} />;
},
}),
tabBarOptions: {
activeTintColor: 'tomato',
inactiveTintColor: 'gray',
},
}
);
<Drawer.Screen name="settingscreen" component={Settings}
options={{
drawerLabel: "Settings",
drawerIcon: ({ color }) => <MaterialCommunityIcons name="settings" size={24} style={[styles.icon, { color: color }]} />
}}
/>