美文网首页
RN中的ERROR和WARNING

RN中的ERROR和WARNING

作者: 偶然中的必然 | 来源:发表于2018-12-31 15:58 被阅读14次

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

    相关文章

      网友评论

          本文标题:RN中的ERROR和WARNING

          本文链接:https://www.haomeiwen.com/subject/atzilqtx.html