简体   繁体   English

安装后 react-native-vector-icons 白屏

[英]After installation react-native-vector-icons white screen

Before installation the react-native-vector-icons, The project is work well.在安装 react-native-vector-icons 之前,该项目运行良好。
But ..但是..
When I install the react-native-vector-icons, I can only see the white screen .当我安装 react-native-vector-icons 时,我只能看到白屏。
It took me two days to solve this problem.我花了两天时间才解决这个问题。
But it doesn't work.但它不起作用。 I add it like this:我这样添加:

npm install react-native-vector-icons --save npm install react-native-vector-icons --save
react-native link反应原生链接

Build success and no error or warnning,I compared with npm website,all of the file was the same,like android/app/build.gradle setting.gradle and so on, but it doesn't work in my android phone.构建成功并且没有错误或警告,我与npm网站相比,所有文件都相同,例如android/app/build.gradle setting.gradle等,但它在我的android手机中不起作用。
Thx for any help!I'm almost broke.感谢您的帮助!我几乎破产了。

You must add below line and run react-native run-android :您必须添加以下行并运行react-native run-android

Android Option: With Gradle (recommended) This method has the advantage of fonts being copied from this module at build time so that the fonts and JS are always in sync, making upgrades painless. Android 选项:使用 Gradle(推荐) 这种方法的优点是在构建时从该模块复制字体,以便字体和 JS 始终同步,使升级变得轻松。

Edit android/app/build.gradle ( NOT android/build.gradle ) and add the following:编辑 android/app/build.gradle (不是 android/build.gradle )并添加以下内容:

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM