活动色调颜色在反应本机底部选项卡导航器中不起作用。焦点时名称的颜色确实会改变,但图标颜色不会改变。这是我的导航器
<Tab.Navigator
screenOptions={({route}) => ({
tabBarIcon: ({focused, tintColor, size}) => {
let iconName;
if (route.name === 'Home') {
iconName = focused
? 'chatbubble-ellipses-sharp'
: 'chatbubble-ellipses-outline';
} else if (route.name === 'Setting') {
iconName = focused ? 'settings-sharp' : 'settings-outline';
}
// You can return any component that you like here!
return (
<Icon
name={iconName}
size={size}
color={tintColor}
type={'Ionicons'}
/>
);
},
})}
tabBarOptions={{
activeTintColor: 'tomato',
inactiveTintColor: 'gray',
}}>
<Tab.Screen name="Home" component={Home} />
<Tab.Screen name="Setting" component={Setting} />
</Tab.Navigator>
);
}
Run Code Online (Sandbox Code Playgroud)
即使我像<Icon …