我正在尝试使用react-navigation设置一个简单的屏幕导航栏。我已经可以进行导航,但是无法在每个标签上显示任何图标。
我尝试使用FontAwesome代替IonicIcons,但是出现带有X的相同Box代替了所需的图标。
import React, {Component} from 'react';
import {createBottomTabNavigator, createAppContainer} from 'react-navigation';
import Icon from 'react-native-vector-icons/Ionicons';
import HomeScreen from './screens/HomeScreen'
import SearchScreen from './screens/SearchScreen'
import ScanScreen from './screens/ScanScreen'
const TabNavigator = createBottomTabNavigator({
Home: {
screen: HomeScreen,
navigationOptions: {
tabBarIcon: () => (<Icon name="md-home" />)
}
},
Scan: {
screen: ScanScreen
},
Search: {
screen: SearchScreen
}
});
export default createAppContainer(TabNavigator);
答案 0 :(得分:2)
您必须在命令提示符下将其链接为react-native-vector-icons:
react-native link react-native-vector-icons