react-native-vector-icons 安装

 

1、安装

npm install --save react-native-vector-icons@9.2.0

 

2、在文件android\app\build.gradle中添加如下代码

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

3、基本使用

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 * @flow
 */

import React, { Component } from 'react';
import { Platform, View, Text, ToastAndroid, BackHandler, Alert } from 'react-native';
import Icon from 'react-native-vector-icons/FontAwesome';

export default class App extends Component {
  render() {
    return (
      <View>
        <Icon name="home" size={25} style={{ width: 26, height: 22 }} />
      </View>
    );
  }
}


 

posted @ 2022-11-15 16:40  斌言  阅读(65)  评论(0编辑  收藏  举报