首先安装引入 react-native-vector-icons,发现app上显示不出图标,网上一大堆说加react-naitve link的,但是新版的react-naitve 已经不需要手动链接依赖了
解决方法:
1 复制安装包中 react-native-vector-icons文件夹下的Fonts文件夹下的内容 到 android/app/src/main/assets/fonts (如果没有就自己手动创建)
2 在build.gradle文件中加入
project.ext.react = [
enableHermes: false, // clean and rebuild if changing
iconFontNames: [ 'AntDesign.ttf','FontAwesome.ttf' ] // 指定要使用的字体库
]
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
相关文章
发表评论