Ionicon 不会显示在 React Native BottomTabNavigator 上
Ionicon won't show on React Native BottomTabNavigator
我正在尝试使用 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);
您必须 link 它 react-native-vector-icons,在您的命令提示符中:
react-native link react-native-vector-icons
我正在尝试使用 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);
您必须 link 它 react-native-vector-icons,在您的命令提示符中:
react-native link react-native-vector-icons