反应本机矢量 icons/fontawesome 在 expo cli 中不显示图标

react native vector icons/fontawesome not showing icons in expo cli

我在 snack expo 中使用 fontawsome 图标构建了布局,但是当 运行 expo cli 中的同一个项目时,图标没有 displayed.It 显示为 cross.App 在 snack 中完美工作但不是在世博会 cli.I 曾尝试用谷歌搜索问题,但解决方案是 gradle 中的更改文件我没有 gardle 文件这是一个小吃 project.Is 有任何解决方案任何帮助都会很棒,谢谢

import Icon from 'react-native-vector-icons/FontAwesome';

  {
    Home: {
      screen: FetchNewsApp,
      navigationOptions: {
        tabBarLabel: 'Home',
        tabBarIcon: ({ tintColor }) => (
          <Icon name="home" color={tintColor} size={25} />
        ),
      },
    },

    Explore: {
      screen: ExploreScreenApp,
      navigationOptions: {
        tabBarLabel: 'Explore',
        tabBarIcon: ({ tintColor }) => (
          <Icon name="wpexplorer" color={tintColor} size={25} />
        ),
      },
    },

    Search: {
      screen: SearchScreenApp,
      navigationOptions: {
        tabBarLabel: 'Search',
        tabBarIcon: ({ tintColor }) => (
          <Icon name="search" color={tintColor} size={25} />
        ),
      },
    },

    Settings: {
      screen: SettingScreenApp,
      navigationOptions: {
        tabBarLabel: 'Settings',
        tabBarIcon: ({ tintColor }) => (
          <Icon name="cog" color={tintColor} size={25} />
        ),
      },
    },

    Profile: {
      screen: ProfileScreenApp,
      navigationOptions: {
        tabBarLabel: 'Profile',
        tabBarIcon: ({ tintColor }) => (
          <Icon name="user-circle" color={tintColor} size={25} />
        ),
      },
    },
  },
  {
    initialRouteName: 'Home',
  }
);

你也用图片代替图标效果很好,

tabBarIcon: ({ tintColor }) => ( <Image source={require('...')} style={{}}/> )

如果您使用的是 expo 管理的应用程序,只需使用 expo 矢量图标 Expo vector icons

因为 React 本机矢量图标需要链接,而这对于 expo 管理的应用程序是不可能的。

以下是小吃上的世博会图标示例: Snack