1.安装
yarn add react-native-vector-icons
2.在项目中导入Fonts

注意Added folders是选择Create groups

在info.plist中添加字体库文件添加Fonts provided by application

或者
vim project_dir/ios/project_name/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>
3.cocoapods安装,进入ios执行pod install
cd ios
pod install
4.删除app
5.进入项目目录重新运行项目
yarn ios
6.[CP] Copy Pods Resources错误
查看项目的Copy Pods Resources是否重复引用,如果重复了进行删除即可

网友评论