1.在使用FlatList的時候 missing keys for items
警告:
VirtualizedList: missing keys for items, make sure to specify a key property on each item or provide a custom keyExtractor.
方法:
_extraUniqueKey =(item ,index) => { return "index"+index+item; }
<FlatList keyExtractor = {this._extraUniqueKey}/>
2.npm start 啟動服務(wù)的時候,遇到 This is probably not a problem with npm. There is likely additional logging output above
解決方法:
更新npm:
執(zhí)行: npm update 再執(zhí)行: yarn
3.Error:Metro Bundler can't listen on port 8081
解決辦法:kill 占用8081端口的其他應(yīng)用
1.找到占用端口的應(yīng)用
$ sudo lsof -i :8081
2.kill (40247 是應(yīng)用的 PID)
kill -9 40247
3.重新啟動8081即可
4.Flatlist出現(xiàn)不顯示的現(xiàn)象,只有滾動一下才顯示(這個問題很無語)
解決辦法:
removeClippedSubviews={false}