![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
React Native
大漠-孤烟
这个作者很懒,什么都没留下…
展开
-
ReactNative 在AndroidStudio下编译react-native-camera报错解决
react-native项目使用到相机做扫码功能,所以用到react-native-camera这个库,1、首先安装依赖库yarn add react-native-camera@git+https://git@github.com/react-native-community/react-native-camera.git2、连接依赖库react-native linkreac...原创 2019-10-15 21:09:02 · 1348 阅读 · 0 评论 -
react-native navigation页面回调函数callback
react-native 在使用navigation进行页面跳转时,有时前一个页面需要知道跳转后的页面的处理结果,这时我们可以用回调函数的方式进行回调数据结果ScreenAthis.props.navigation.navigate('screenB', { callBack: (result) => this.setState({res:result});});...原创 2019-10-12 13:05:49 · 1863 阅读 · 0 评论 -
使用react-native-qrcode生成二维码
安装npm install react-native-qrcode --save使用import QRCode from 'react-native-qrcode';<QRCode value={this.state.text} size={200} bgColor='#000' fgColor='#333'/>value:...原创 2019-10-12 12:51:06 · 1032 阅读 · 0 评论 -
React Native 查看console日志
在命令行运行adb logcat *:S ReactNative:V ReactNativeJS:V即可看见应用console的打印日志信息原创 2019-10-12 12:37:44 · 2034 阅读 · 0 评论 -
React Native 使用native-echarts图表组件
1、安装yarn add native-echarts2、导入包importEcharts from'native-echarts';3、使用示例const option = {tooltip: {trigger: 'axis'},toolbox: {show: false,feature...原创 2019-06-25 21:46:43 · 1010 阅读 · 0 评论 -
React Native 使用NavigationService定义全局路由
没有注册到React Navigation的StackNavigator的组件,比如子组件,调用this.props.navigation.navigate的相关方法是无法跳转到相应的页面的,如果想在子组件中跳转到某个页面,可以在父组件把props传递到子组件里面,不过比较繁琐,其实有另一种方法是定义一个全局路由,可以在没有注册到StackNavigator的页面也可以进行路由跳转到其他页面。具...原创 2019-06-17 18:34:14 · 1132 阅读 · 0 评论 -
React Native 使用setNativeProps局部刷新组件
在React Native中可以通过setState实现刷新组件,setState会触发render()方法重新渲染,页面布局复杂的时候会遇到性能问题,React Native提供局部刷新组件的方法setNativeProps,使用如下<Viewref={(c) => this.refView= c}></View>在需要触发局部更新组件的事件中...原创 2019-06-27 09:58:39 · 1803 阅读 · 0 评论 -
React-native-device-info获取设备信息
React-native-device-info 是一个在React Native中获取移动设备信息的第三方库安装 :yarn add react-native-device-info链接原生代码库:react-native link react-native-device-info引入组件import DeviceInfo from 'react-native-device-in...原创 2019-06-27 09:58:26 · 2647 阅读 · 0 评论 -
React Native WebSocket使用
可在客户端和服务端双向通信,加入了客户端心跳检测和断开重连机制,代码实现过程已经有比较详细的注释React Native客户端代码WebSocketClient.jsimport { DeviceEventEmitter} from 'react-native';const url = 'ws://xxx/websocket/chat';let that = null;...原创 2019-10-12 23:52:39 · 7881 阅读 · 1 评论