0

我正在尝试使用 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);
4

1 回答 1

2

您必须在命令提示符中链接它 react-native-vector-icons:

 react-native link react-native-vector-icons
于 2019-05-13T17:00:49.710 回答