我是新来的本地人,正在尝试在我的标签菜单中显示图标。
我已经尝试使用FontAwesome,FontAwesome5,react-native-vector-icons和Ionicons。这些似乎都没有显示任何图标,我也不知道为什么。
这是我的代码。
const TabNavigator = createBottomTabNavigator({
Home: {
screen: HomeScreen,
defaultnavigationOptions: {
tabBarIcon: ({ tintColor }) => (
<Icon name="home" color="#ccc"size={25} />
)
},
},
Events: {
screen: EventScreen,
defaultnavigationOptions: {
tabBarIcon: ({ tintColor }) => (
<Icon name="home" color="#ccc"size={25} />
)
},
About: {
screen: AboutScreen,
defaultnavigationOptions: {
tabBarIcon: ({ tintColor }) => (
<Icon name="home" color="#ccc"size={25} />
)
}
},
{ tabBarOptions: {
showIcon: true,
activeTintColor: '#D4AF37',
inactiveTintColor: 'gray',
style: {
backgroundColor: 'white',
},
labelStyle: {
fontSize: 20,
}
}
}
);
尝试这种方式
const MainNavigator = createBottomTabNavigator(
{
Home: {
screen: HomeNavigation,
navigationOptions: ({navigation}) => ({
title: 'home',
tabBarIcon: <Icon name="home" color="#ccc"size={25} />,
}),
},
{
initialRouteName: 'Home',
lazy: false,
tabBarOptions: {
activeTintColor: '#d63921',
labelPosition: 'below-icon'
},
},
);
毫无疑问。