一、Debug時在Chrome顯示“Cached Bundles”
這個問題是由于瀏覽器緩存問題引起的,只需要在Chrome清除緩存
WX20180510-111829@2x.png
二、Debug時Realm報出“Failed to load create_session”
IMG_0042.PNG
這個問題是跨域請求引起的,有兩種解決方式
1、在Chrome退出的情況下直接在終端輸入
open -a Google\ Chrome --args --disable-web-security --user-data-dir
2、給Chrome下載插件“Allow-Control-Allow-Origin: *”
下載鏈接在這,記得要翻墻https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi/related
三、webview不支持Basic Authentication
1、https://github.com/facebook/react-native/issues/19200
四、性能注意點(diǎn)
{...this.props}
(不要濫用,請只傳遞component需要的props,傳得太多,或者層次傳得太深,都會加重shouldComponentUpdate里面的數(shù)據(jù)比較負(fù)擔(dān),因此,請慎用spread attributes(<Component {...props} />))。::this.handleChange()
。(請將方法的bind一律置于constructor)this.handleChange.bind(this,id)
復(fù)雜的頁面不要在一個組件里面寫完。
請盡量使用
const element
。map里面添加key,并且key不要使用index(可變的)。具體可參考使用Perf工具研究React Key對渲染的影響
盡量少用
setTimeOut
或不可控的refs、DOM操作。props
和state
的數(shù)據(jù)盡可能簡單明了,扁平化。使用
return null
而不是CSS的display:none
來控制節(jié)點(diǎn)的顯示隱藏。保證同一時間頁面的DOM節(jié)點(diǎn)盡可能的少
五、CSS樣式兼容問題
borderBottomColor
六、scrollTo Android 不生效
涉及到ScrollView、ListView等,會遇到srollTo方法不工作,首先要檢查一下布局,它的容器和本身不要用‘a(chǎn)bsolute’布局
七、結(jié)語
后面會繼續(xù)補(bǔ)充進(jìn)來,如有補(bǔ)充大家可以私信我。