在React Native项目中配置ios的字体图标库

200 阅读1分钟
  1. 安装react-native-vector-icons
yarn add react-native-vector-icons 
# 或者使用npm进行安装 
npm i react-native-vector-icons -S
  1. 进入到这个目录ios/Podfile, 添加下面这行代码
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
  1. 运行
cd ios

pod install
  1. 进入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>
  1. 重新编译ios app
yarn ios