react-native-vector-icons的使用

版权声明:欢迎大家关注我的博客,更多文章请移步新的地址:http://student9128.top https://blog.csdn.net/student9128/article/details/80391145

react-native-vector-icons是react native中一个第三方图标库。
使用起来非常方便。
这里只说Andronid。该库有添加字体的使用,这里只记录我自己用到的。方便以后使用。

通过如下命令行添加依赖库:

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

Android使用要在project gradle中添加一行代码

使用起来就是下面这样

import Icon from 'react-native-vector-icons/Ionicons';

export default class SomeView extends Component{
  render() {
    return (
      <View>
        <Icon name='md-contact' size={30} color='black'/>
      </View>
    )
  };
}
效果图:
左侧是没在gradle添加代码的效果, 右侧是添加后的效果

猜你喜欢

转载自blog.csdn.net/student9128/article/details/80391145