wuyunqiang
wuyunqiang
1:onLoadStart里面setState造成卡顿 2:thirdPartyCookiesEnabled={true} //设置android cookie
``` static JsType(obj) { let class2type = {}; // 生成class2type映射 "Boolean Number String Function Array Date RegExp Object Error".split(" ").map(function(item, index) { class2type["[object " + item + "]"] = item.toLowerCase();...
Created by wuyunqiang 驼峰式:第二个单词首字母大写 大驼峰式:每个单词的首字母都是大写的 默认是驼峰式 ## 一:文件 1:文件夹 全部小写字母 例如:page,component,assets 2:js文件 大驼峰式规范 页面Page结尾 工具Util结尾 原生组件Android||IOS结尾 最后统一导出 例如: HomePage HttpUtil WebAndroid||WebIOS=>统一在Web.js里面导出 ## 二:变量 ### 禁止使用var 实例变量let 实例常量const 静态属性static 1:全局属性(项目启动即引用) 全部大写...
Mac 系统 1:touch android.sh 2:vim android.sh 3:copy code to android.sh: ``` #!/usr/bin/env bash ANDROID_PATH_EXIST=`cat ~/.bash_profile | grep ANDROID_NDK=` if [ "$ANDROID_PATH_EXIST" == "" ]; then echo ' export ANDROID_NDK=$HOME/Library/Android/ndk '...
减少setState次数 数据. immutable 组件. purcomponent component-shouldComponentUpdate setNativeProps 事件. touchable InteractionManager.runAfterInteractions 少用匿名函数 结构. 组件化最大化共用,拆分组件单元 原生优化
rm ./node_modules/react-native/local-cli/core/__fixtures__/files/package.json link:https://github.com/oblador/react-native-vector-icons/issues/626
``` import {AsyncStorage} from 'react-native'; import Storage from 'react-native-storage'; const Key = 'wuyunqiang' const storage = new Storage({ // 最大容量,默认值1000条数据循环存储 size: 1000, // 存储引擎:对于RN使用AsyncStorage,对于web使用window.localStorage 如果不指定则数据只会保存在内存中,重启后即丢失 storageBackend: AsyncStorage, // 数据过期时间,默认一整天(1000 *...
解决 方式一: ``` class Input extends Component{ constructor(){ super(); this.amount=0; } componentWillReceiveProps(nextProps) { if(this.props.amount!=nextProps.amount){ this._textInput&&this._textInput.setNativeProps({text: nextProps.amount});//重点 } } setAmout = (text)=>{ this.amount = text; }; getAmout = ()=>{ this.props.getAmout&&this.props.getAmout(this.amount); };...
完成例子: https://github.com/wuyunqiang/RNApp rn端: ``` //接收来自H5的消息 onMessage = (e)=>{ Log('WebView onMessage 收到H5参数:',e.nativeEvent.data); let params = e.nativeEvent.data; params = JSON.parse(params); Log('WebView onMessage 收到H5参数 json后:',params); }; onLoadEnd =(e)=>{ Log('WebView onLoadEnd e:',e.nativeEvent); let data...