RN中的ERROR和WARNING

ERROR

1. 'config.h' file not found
error.png
cd node_modules/react-native/third-party/glog-0.3.4

../../scripts/ios-configure-glog.sh
2. npm ERR! Unexpected end of JSON input while parsing near
1.刪掉package.lock.json

2.清除cache
npm cache clean --force
3. Build input file cannot be found '/Users/xxx/Desktop/xxx/node_modules/react-native/Libraries/WebSocket/libfishhook.a
1.進(jìn)入RCTWebSocket.xcodeproj

2.進(jìn)入Build Phases的Link Binary With Libraries

3.重新添加libfishhook.a
4. Support for the experimental syntax 'decorators-legacy' isn't currently enabled
1.進(jìn)入 .babelrc

2.添加
 "plugins": [
    ["@babel/plugin-proposal-decorators", { "legacy": true }]
  ]
5. reactDevTools.connectToDevTools is not a function (react-native: 0.57.8) Issues鏈接
error.png
1. 在package.json中添加
  "resolutions": {
      "react-devtools-core": "3.4.3"
   }

2. yarn

3. yarn start --reset-cache

WARNING

1. mobx在react native中報(bào)的警告: attempt to read an array index that is out of bounds
使用slice消除警告 Issues鏈接
<FlatList
  data={ states.dataSource.slice() }
/>
<SectionList
  sections={ states.formattedList }
/>

@observable dataSource = [
        {
            title: 'header',
            data: [
                {
                    title: 'test1',
                    info: '123'
                },
                {
                    title: 'test2',
                    info: '456'
                }
            ]
        }
    ]

@computed get formattedList(){
   return this.dataSource.map((v)=>{
       return {
           title: v.title,
           data: v.data.slice(),
       }
   }).slice();
}
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容