【发布时间】:2018-10-10 14:27:32
【问题描述】:
我使用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 截图也是如此。
【问题讨论】:
标签: javascript reactjs react-native react-navigation