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.进入RCTWebSocket.xcodeproj

2.进入Build Phases的Link Binary With Libraries

3.重新添加libfishhook.a
4. Support for the experimental syntax 'decorators-legacy' isn't currently enabled
1.进入 .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中报的警告: attempt to read an array index that is out of bounds
使用slice消除警告 Issues链接



@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();
}

你可能感兴趣的:(RN中的ERROR和WARNING)