React native 链接后,反应本机矢量图标显示为X

React native 链接后,反应本机矢量图标显示为X,react-native,npm,icons,npx,react-native-vector-icons,React Native,Npm,Icons,Npx,React Native Vector Icons,我使用以下命令安装了React本机矢量图标: npm安装反应本机矢量图标--保存 其结果是: -- react-native-vector-icons@7.1.0 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.2 (node_modules\jest-haste-map\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsup

我使用以下命令安装了React本机矢量图标:

npm安装反应本机矢量图标--保存

其结果是:

-- react-native-vector-icons@7.1.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^2.1.2 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\metro\node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\metro-core\node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN jsdom@15.2.1 requires a peer of canvas@^2.5.0 but none was installed.
npm WARN ws@7.3.1 requires a peer of bufferutil@^4.0.1 but none was installed.
npm WARN ws@7.3.1 requires a peer of utf-8-validate@^5.0.2 but none was installed.
npm WARN ws@7.3.1 requires a peer of bufferutil@^4.0.1 but none was installed.
npm WARN ws@7.3.1 requires a peer of utf-8-validate@^5.0.2 but none was installed.
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none was installed.
npm WARN use-subscription@1.5.0 requires a peer of react@^17.0.0 but none was installed.
然后,我用命令链接图标:

npx react原生链接react原生向量图标

其结果是:

warn Calling react-native link [packageName] is deprecated in favor of autolinking. It will be removed in the next major release.
Autolinking documentation: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
info iOS module "react-native-vector-icons" is already linked
info Linking "react-native-vector-icons" Android dependency
info Android module "react-native-vector-icons" has been successfully linked
info Linking assets to ios project
info Linking assets to android project
success Assets have been successfully linked to your project
在App.js中,我然后导入屏幕上显示的图标,如下所示:

<View>
    <Icon name="rocket" size={30} color="#900" />
</View>
从'react native vector icons/fontsome'导入图标

然后将其插入视图标记中,如下所示:

<View>
    <Icon name="rocket" size={30} color="#900" />
</View>

但显示的图标是一个带有X的框。 像这样:

我不明白发生了什么,因为下载和链接过程似乎都很好? 我尝试使用其他一些图标进行测试,它们都有X。CLI或应用程序中没有错误

我也试着看a,但没有运气,因为我按照指示的步骤,我仍然有X


感谢您的帮助。我是新来的React Native-谢谢

请登录您的android/app/build.gradle(非android/build.gradle)并添加以下行:

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
然后重建并尝试android应用程序

请参考android安装指南

请签入您的android/app/build.gradle(非android/build.gradle)并添加以下行:

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
然后重建并尝试android应用程序

请参考android安装指南