[RN] React Native 使用精美图标库react-native-vector-icons

 React Native 使用精美图标库react-native-vector-icons

一、安装依赖

npm install --save react-native-vector-icons // 下载库
react-native link react-native-vector-icons // 自动关联

二、使用

import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'; 
import FontAwesome from 'react-native-vector-icons/FontAwesome'; 

<FontAwesome name={'wpforms'} size={30} color={tintColor} /> 

<MaterialCommunityIcons name={'face'} size={30} color={tintColor} /> 

使用说明:
react-native-vector-icons 的图标分为几个模块, 使用的时候先import FontAwesome from 'react-native-vector-icons/FontAwesome';

这样才能使用 FontAwesome 标签, 标签内使用 name 字段指定是某个图标.

使用的时候可以使用这个网站找到所有图标的索引:
https://oblador.github.io/react-native-vector-icons/

本博客地址: wukong1688

本文原文地址:https://www.cnblogs.com/wukong1688/p/10860490.html

转载请著名出处!谢谢~~

猜你喜欢

转载自www.cnblogs.com/wukong1688/p/10860490.html