使用react-native-vector-icons(RN0.6+)

1.安裝

npm install --save react-native-vector-icons
or 
yarn add react-native-vector-icons

2.配置

2.1.IOS配置html

修改 info.plist 添加node

複製代碼
<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>
  <string>Fontisto.ttf</string>
</array>
複製代碼

在ios目錄執行 pod install react

2.2.Android配置android

修改 android/app/build.gradle 在第二行添加ios

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

3.使用

打開https://oblador.github.io/react-native-vector-icons/找到本身須要的icon,引入本身的工程便可git

import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';

<FontAwesome5
    name={'microphone'}
    size={30}
 />

 

在mac中遇到了問題,經過這個解決了,轉載自 http://www.javashuo.com/article/p-ziwwobwr-nw.htmlgithub

相關文章
相關標籤/搜索