我正在使用“ react-native-vector-icons”中的图标设置一个新组件,并且出现黄色警告。
这是图标的新功能
Dashboard: {
screen: DashboardStack,
navigationOptions: {
title: 'HOME',
tabBarOnPress: ({ navigation, defaultHandler }) => handleTabPress(navigation, defaultHandler),
tabBarIcon: ({ focused, tintColor }) => {
// HERE IS THE PROBLEM //
return <SSIcon name={'home'} size={20} color={focused ? GStyle.GREEN : Color(GStyle.BLACK).alpha(.45)} />
},
}
},
我希望没有黄色警告
答案 0 :(得分:0)
您可以尝试使用此代码
<SSIcon name={'home'} size={20} color={focused ? "green" : "black"} />
答案 1 :(得分:0)
您是否尝试过分色?
const stackNav = createStackNavigator ({
Dashboard: {
screen: DashboardStack,
navigationOptions: {
title: 'HOME',
tabBarOnPress: ({ navigation, defaultHandler }) => handleTabPress(navigation, defaultHandler),
tabBarIcon: ({ focused, tintColor }) => <SSIcon name={'home'} size={20} color={tintColor} />
}
}}, {
tabBarOptions: {
activeTintColor:GStyle.GREEN,
inactiveTintColor: Color(GStyle.BLACK).alpha(.45)
})
答案 2 :(得分:-1)
在应用程序的根
index.js
中添加以下行:
console.disableYellowBox = true;