0

我在snack expo中使用fontawsome图标构建了布局,但是当在expo cli中运行相同的项目时,图标不显示。它显示为一个交叉。应用程序在snack中完美运行,但在expo cli中没有。我试过用谷歌搜索problelem但是解决方案是 gradle 中的更改文件,我没有 gardle 文件,这是一个小吃项目。有任何解决方案,任何帮助都会非常好,谢谢。

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',
  }
);
4

2 回答 2

1

如果您使用的是世博管理应用程序,只需使用世博矢量图标 世博矢量图标

因为反应原生矢量图标需要链接,而这在 expo 托管应用程序中是不可能的。

这是小吃博览会图标的示例: 小吃

于 2019-09-25T12:43:42.087 回答
0

您还可以使用图像替换图标,它可以正常工作,

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

于 2019-09-25T12:26:08.067 回答