当前位置: 首页 > 工具软件 > Feather icons > 使用案例 >

react-native-vector-icons 安装及使用

浦修文
2023-12-01

1、安装

yarn add react-native-vector-icons(或者 npm install react-native-vector-icons)

2、react-native link react-native-vector-icons 进行自动连接,如果报错,react-native unlink react-native-vector-icons这样先卸载掉之前的link,然后:

命令运行:pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
命令运行:pod update (or pod install).
在到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>

我用的ios起来就成功了

安卓的使用配置可以看看 https://github.com/oblador/react-native-vector-icons#option-with-cocoapods

 类似资料: