首页 > 其他 > 详细

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

时间:2020-07-27 12:51:47      阅读:66      评论:0      收藏:0      [点我收藏+]

1.安装

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

2.配置

2.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>
  <string>Fontisto.ttf</string>
</array>

在ios目录执行 pod install 

2.2.Android配置

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

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

3.使用

打开https://oblador.github.io/react-native-vector-icons/找到自己需要的icon,引入自己的工程即可

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

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

 

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

原文:https://www.cnblogs.com/dch0/p/13383877.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!