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

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章