安装

执行

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

每个平台有不同的配置方式,需要逐一配置android/ios等

Android配置

编辑 android/app/build.gradle文件(注意:不是android/build.gradle)在最后面追加

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

如果指定导入哪些字体则按下面的配置

project.ext.vectoricons = [
    iconFontNames: [ 'MaterialIcons.ttf', 'EvilIcons.ttf' ] // Name of the font files you want to copy
]

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

重新运行

react-native run-android

Tags: react-native, react-native-vector-icons

Related Posts:

Leave a Comment