React-native开发-Unrecognized font family ‘Ionicons’

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhaolaoda2012/article/details/82627735

错误如下:
这里写图片描述

解决方法:
先打开你的react-native项目的ios文件夹下面的项目,右键选择add file
这里写图片描述

将font文件添加到项目里面:
这里写图片描述

然后还需要到info.plist文件添加一些配置:
这里写图片描述

复制下面的内容到plist里面:

<key>UIAppFonts</key>
  <array>
    <string>Entypo.ttf</string>
    <string>EvilIcons.ttf</string>
    <string>FontAwesome.ttf</string>
    <string>Foundation.ttf</string>
    <string>Ionicons.ttf</string>
    <string>MaterialIcons.ttf</string>
    <string>Octicons.ttf</string>
    <string>SimpleLineIcons.ttf</string>
    <string>Zocial.ttf</string>
    <string>MaterialCommunityIcons.ttf</string>
  </array>

如下图:
这里写图片描述

这样就大功告成啦。重新运行项目就行了。

猜你喜欢

转载自blog.csdn.net/zhaolaoda2012/article/details/82627735