因为在react-native中无法直接引用各种各样的图标,还好已经有人做好了相关组件, react-native-vector-icons就是比较好用的,可以让你开发过程中使用各式各样的图标。 1、正常命令安装 $ npm install react-native-vector-icons --save $ sudo npm i rnpm@1.7.0 -g //安装rnpm,并锁定版本号为1.7.0 $ rnpm link react-native-vector-icons //连接 2、然而我安装出现了 ?
安装方法 npm i react-native-action-button --save react-native link react-native-vector-icons 因为用到了react-native-vector-icons 如果你项目中已经使用了react-native-vector-icons,那就不需要这步了。
问题 yarn add react-native-vector-icons后图省事使用react-native link来添加native配置,结果run时报错。 appcompat-v7:23.0.1" compile "com.facebook.react:react-native:+" // From node_modules + compile project(':react-native-vector-icons
进入到我们的工程文件夹下, (不会创建工程的请参考:http://blog.csdn.net/margaret_mo/article/details/51304062) 输入: npm install react-native-vector-icons /Demo/ios/Demo.xcodeproj (1).右键工程文件Add Files to "(你工程名)" (2).选择node_modules/react-native-vector-icons StyleSheet, AlertIOS, Text, TabBarIOS, NavigatorIOS, } from 'react-native'; var Icon = require('react-native-vector-icons 主要代码下载地址: http://download.csdn.net/detail/margaret_mo/9512769 参考网站: https://github.com/oblador/react-native-vector-icons
/page/PopularPage'; import MaterialIcons from 'react-native-vector-icons/MaterialIcons'; import TrendingPage
安装方法如下: npm install react-native-vector-icons --save 安装好了之后记得一定要输入下面的命令 rnpm link 重新编译即可使用 import Icon from 'react-native-vector-icons/Ionicons'; //这个是图标 以下是整个MyTabBar文件的全部代码。 StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import Icon from 'react-native-vector-icons ScrollableTabView, {DefaultTabBar, ScrollableTabBar} from 'react-native-scrollable-tab-view'; import Icon from 'react-native-vector-icons /Ionicons'; import IconFont from 'react-native-vector-icons/FontAwesome'; import MyTabBar from '.
安装第三方库假设我们想要使用react-native-vector-icons库来添加图标: npm install react-native-vector-icons npx react-native 以引入图标: import React from 'react'; import { View, Text } from 'react-native'; import Icon from 'react-native-vector-icons
React Native中的iconfont 关于在React Native中使用iconfont,网上已有很多非常好的解决方案,用的最多的就是react-native-vector-icons , 这个库支持很多常用的 IconFont的使用原理 其实IconFont就是一些文字,通过在web上的使用,我们可以大概猜出使用方法: 指定字体集 把对应的16进制码当成文字写到文本中 在React Native中同样如此,我们可以通过react-native-vector-icons 打开react-native-vector-icons/FontAweson.js文件(线上地址)可以看到一个大大的json对象 var createIconSet = require('.
. ; 4.A problem occurred evaluating project ':react-native-vector-icons'. > Could; 5.Could not find method 难点4: 搭架构.由于用的是低版本的react-native(0.53.3),所以很多组件库也得用相应的版本.比如用到的mobx,react-navigation,react-native-video,react-native-vector-icons
数据方面是用豆瓣的Gank的妹子api 所用到的第三方控件如下: React-native-vector-icons(一个可以用的网上图标库,不用自己设计), React-native-scrollable-tab-view
新的页面导航方案 react-native-elements 一个react native UI库 lodash JS函数库 react-native-autoheight-webview webview解决方案 react-native-vector-icons
ToastAndroid } from 'react-native' var ImagePicker = require('react-native-image-picker'); import Icon from 'react-native-vector-icons
/utils/Utils' import Icon from 'react-native-vector-icons/Ionicons' import PropTypes from 'prop-types
Component, PropTypes, } from 'react'; import { View, } from 'react-native'; import Icon from 'react-native-vector-icons
在上述代码中使用了react-native-vector-icons的矢量图标作为Tab的显示图标,drawerIcon接收一个React 组件,大家可以根据需要进行定制: tintColor: 当前状态下
ios-people-outline'} size={26} style= /> ), } }, 在上述代码中使用了react-native-vector-icons
Actions } from 'react-native-router-flux'; import Button from 'react-native-button'; import Icon from 'react-native-vector-icons
TouchableOpacity } from 'react-native'; import Camera from 'react-native-camera'; import Icon from 'react-native-vector-icons
react-native-simple-modal 毛玻璃效果 https://github.com/react-native-fellowship/react-native-blur 头像库 https://github.com/oblador/react-native-vector-icons
ios-people-outline'} size={26} style= /> ), } }, 在上述代码中使用了react-native-vector-icons