[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

轉載請著名出處!謝謝~~


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM