- 博客(12)
- 收藏
- 关注
原创 react-native-sound
播放本地文件import Sound from ‘react-native-sound’;let demoAudio = require(’./sounds/.m4a’);//支持众多格式const s = new Sound(demoAudio, (e) => {if (e) {console.log(‘播放失败’);return;}s.play(() => s.re...
2019-11-13 11:18:53
434
原创 加载系统,三方组件冲突
在使用地图定位跟需要用到RN定时器的时候,setInterval引用冲突了,这是导入例如高德地图import { init, Geolocation, // setInterval, setNeedAddress, setLocatingWithReGeocode, setDistanceFilter, stop, setOnceL...
2019-11-04 10:49:32
368
原创 error: bundling failed: NotFoundError: Cannot find entry file index.ios.js in any of the roots:
RN运行时android调试正常,在ios运行时终端报错,Build编译是正常的 error: bundling failed: NotFoundError: Cannot find entry file index.ios.js in any of the roots: ["/Users/hld/Desktop/project/RN/ZRApp"] at Dependency...
2019-04-03 11:05:38
777
翻译 React-Native生命周期
任何生命体都会经历从出生到消亡的过程,而 React Native 框架中的组件同样具有这样的属性。在组件生命周期的每个阶段,React Native 提供了多个生命周期函数,供开发者作为切入组件生命周期的钩子(hook),这样在对应的时间点程序就可以做对应的逻辑处理,从而实现相应的功能。在 React Native 程序启动时,内部的虚拟 DOM 开始建立,生命周期就是建立在此虚拟 DOM ...
2019-03-29 11:41:45
1080
原创 通讯录右侧字母的点击滚动跳转 计算偏移量
**通讯录右侧字母的点击滚动跳转 计算偏移量**点击右侧字母导航,SectionList滚动到对应的节点上1.1. 给字母索引列表的item加一个点击事件1.2. 定义_onSectionselect(滚动事件)_onSectionselect = (key) => { let offset = key * 20; //点击了那个字母索引,没有sec...
2019-03-29 11:28:57
1107
原创 RN日期选择器react-native-modal-datetime-picker
默认采用服务器上获取到的数据在界面显示 kWord readOnly es5的写法if (this.props.resopnseJson != null) { console.log(this.props.resopnseJson.applyDate.kWord +';;;;;;') return ( <DateTimeBtnCell tit
2017-09-12 11:36:50
11105
原创 RN es6的几种常用用法
属性类型和默认属性可以统一使用static成员来实现class Video extends React.Component { static defaultProps = { autoPlay: false, maxLoops: 10, }; // 注意这里有分号 static propTyp
2017-09-12 11:31:38
1907
原创 rn 通讯录树状结构
官网,以及网上都有常见的Navigator的案例,基本上都是Navigator的直接使用,如果先需要展开一个三级子目录,到第三级,然后点击item跳转到另一个页面,那么Navigator怎么进行数据的传递呢?由于三级目录在同一个页面展示,经三元运算符或if条件判断,确定子级的显示与隐藏,因此在最底层通过this.props获取不到navigator,需要进行参数的逐级传递,具体见以下案例: 这里写
2017-09-12 11:25:29
1018
原创 ReactNative 退出到后台一定时间之后,跳转到登录界面
****实现长时间不操作应用,可以自定义多长时间,直接跳转到登录界面,登录之后才能再进行操作****let pTimes;let BACK_TO_LOGIN_TIME = 120;constructor(props) { super(props); this.state={ currentAppState:AppState.currentState, }}co
2017-08-12 20:40:05
4070
原创 ReactNative报错问题汇总,错误解决
Svn checkout下来的文件,如果在在Mac电脑上运行,项目运行的时候出现以下错误 ,但是模拟器或者android环境已经安装完全,找不到其他问题 ‘Could not install the app on the device, read the error above for details. Make sure you have an Android emulator runnin
2017-08-12 20:20:32
931
原创 RN演示类似购物车清空的功能, 异步存储AsyncStorage
由Navigator跳转到本界面,实现点击添加商品信息,异步存储点击确定按钮跳转到结算界面,实现添加商品的数据读取与界面展示,并实现点击清空按钮,清空当前页面的数据,返回到上一界面与数据的初始化!Navigator跳转到的当前界面:import React, { Component,} from 'react';import { StyleSheet, Text,
2017-08-12 19:33:42
480
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人