美文网首页
矢量图标(react-native-vector-icons)1

矢量图标(react-native-vector-icons)1

作者: 你坤儿姐 | 来源:发表于2019-11-03 16:47 被阅读0次

到Github搜索react-native-vector-icons打开,到installation中查看如何安装
https://github.com/oblador/react-native-vector-icons
打开图标库:https://oblador.github.io/react-native-vector-icons/

iOS安装如下:

npm install --save react-native-vector-icons
或者
yarn add react-native-vector-icons
2.到项目ios文件夹下/你的项目名/Image.ecassets/Info.plist中,将下面代码复制进去

<key>UIAppFonts</key>
<array>
  <string>AntDesign.ttf</string>
  <string>Entypo.ttf</string>
  <string>EvilIcons.ttf</string>
  <string>Feather.ttf</string>
  <string>FontAwesome.ttf</string>
  <string>FontAwesome5_Brands.ttf</string>
  <string>FontAwesome5_Regular.ttf</string>
  <string>FontAwesome5_Solid.ttf</string>
  <string>Foundation.ttf</string>
  <string>Ionicons.ttf</string>
  <string>MaterialIcons.ttf</string>
  <string>MaterialCommunityIcons.ttf</string>
  <string>SimpleLineIcons.ttf</string>
  <string>Octicons.ttf</string>
  <string>Zocial.ttf</string>
</array>

然后在项目下将目标切换到ios 安装目标库
cd ios
pod install

屏幕快照 2019-11-03 16.10.43.png

Android安装如下:

到项目中android文件夹下android/app/build.gradle下将
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
放入在该文件的第二行。
就安装好了库,接下来就是安装使用了

安装使用

打开Github中的如下链接,可以查看图标库,公司的设计人员也可以将自己设计的图标添加到图标库中。

屏幕快照 2019-11-03 16.19.31.png
引入要使用的图标库,比如Ionicons
import AntDesign from 'react-native-vector-icons/AntDesign
<View style={styles.sectionContainer}>
              <Text>矢量图标</Text>
              <AntDesign
                name={'customerservice'}
                size={50}
                style={{color:'red'}}
              />
</View>

相关文章

网友评论

      本文标题:矢量图标(react-native-vector-icons)1

      本文链接:https://www.haomeiwen.com/subject/fgtlbctx.html