使用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配置

修改 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}
 />

 

在mac中遇到了问题,通过这个解决了,转载自 https://www.cnblogs.com/dch0/p/13383877.html

posted @   一步一步向上爬  阅读(532)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· 展开说说关于C#中ORM框架的用法!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
点击右上角即可分享
微信分享提示