我使用react-native-vector-icons/FontAwesome
来显示图标,使用react-navigation
来显示选项卡。我试图在按钮导航中显示主页图标,但图标没有出现。
Icon和createBottomTabNavigator的PFB相关代码
import React from 'react';
import { createBottomTabNavigator } from 'react-navigation';
// import { Icon } from 'react-native-elements';
import Icon from 'react-native-vector-icons/FontAwesome';
import Account from '../../Form/components/Account';
import Home from '../../Layout/components/Home';
export const Tabs = createBottomTabNavigator({
Account: {
screen: Account,
navigationOptions: {
tabBarLabel: 'Account',
tabBarIcon: ({ tintColor }) => <Icon name="rocket" size={35} color="#fdc94c" />
}
},
Home: {
screen: Home,
navigationOptions: {
tabBarLabel: 'Home',
tabBarIcon: ({ tintColor }) => <Icon name="rocket" size={35} color="#fdc94c" />
},
}
}, {
order: ['Home', 'Account'],
tabBarOptions: {
showLabel: true,
showIcon: true,
activeBackgroundColor: '#42a5f5',
style: {
backgroundColor: '#42a5f5',
paddingVertical: 10,
height: 60
},
indicatorStyle: {
backgroundColor: '#42a5f5',
}
}
})
还有 PFB 屏幕截图。
最佳答案
使用 react-native link react-native-vector-icons
确保字体已链接到您的 iOS 工作区中,然后重建应用程序
遵循文档并确保一切都按照他们提到的方式设置 https://github.com/oblador/react-native-vector-icons#ios
关于javascript - 图标没有出现在 react native 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52742538/