React Native 0.71.1版本中使用react-native-elements报错: Unrecognized font family ‘Material Icons‘解决方法

最近在使用React Native开发APP,使用到了react-native-elements的UI,其中用到了图标库,iOS端启动报错Unrecognized font family 'Material Icons',安卓端不报错,但图标不选显示。

环境:

"react-native": "0.71.1",	
"react-native-vector-icons": "^9.2.0",

解决方法如下:

iOS端

在info.plist插入以下代码

<key>UIAppFonts</key>
<array>
<string>AntDesign.ttf</string>
<string>Entypo.ttf</string>
<string>EvilIcons.ttf</string>
<string>Feather.ttf</string>
<string>FontAwesome.ttf</string>
<string>FontAwesome5_Brands.ttf</string>
<string>FontAwesome5_Regular.ttf</string>
<string>FontAwesome5_Solid.ttf</string>
<string>Foundation.ttf</string>
<string>Ionicons.ttf</string>
<string>MaterialIcons.ttf</string>
<string>MaterialCommunityIcons.ttf</string>
<string>SimpleLineIcons.ttf</string>
<string>Octicons.ttf</string>
<string>Zocial.ttf</string>
</array>

 

安卓端

将 node-modeles\react-native-vector-icons\Fonts目录下的文件复制到项目andriod\app\src\main\assets\fonts 目录下,如果没有相应的文件夹的话,自己创建一个即可。

注意:无需修改build.gradle文件夹的任何配置

 

参考文献:
1、https://blog.csdn.net/m0_59183852/article/details/128103485

猜你喜欢

转载自blog.csdn.net/qq_35624642/article/details/128960997