重要解决方案

2019/4/8 posted in  web

Clean (cmd+shift+K)
Build core React - select React as the scheme in Xcode and build it (cmd+B)
Build the library that is failing (e.g. RCTText).
Build your app.

异常:React/RCTBridgeModule.h' file not found

首先要先把React Build一遍
https://facebook.github.io/react-native/docs/linking-libraries-ios.html

在把这里添加上react的依赖

异常 Undefined symbols for architecture x86_64: "_JSClassCreate"

https://github.com/f111fei/react-native-unity-view/issues/89

这里需要添加javascript的依赖

异常 ../node_modules/react-native/packager/react-native-xcode.sh: No such file or directory

https://github.com/facebook/react-native/issues/14935

最后还是修改成scripts

最后还是用scripts完成的。

问题:

react-native cannot read property 'bindings' of null

解决方案

https://stackoverflow.com/questions/51220030/react-native-cannot-read-property-bindings-of-null

最后是换了相关的babel包。

修改 babel

babel.rc

{
    "presets": ["module:metro-react-native-babel-preset"],
    "env": {
        "development": {
          "plugins": ["@babel/transform-react-jsx-source"]
        }
      },
      "plugins": ["@babel/plugin-proposal-nullish-coalescing-operator"]
}

需要更新依赖:

package.json文件如下

{
  "name": "GankIO",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "@babel/core": "^7.4.3",
    "@babel/plugin-transform-react-jsx": "^7.3.0",
    "react": "^16.8.3",
    "react-native": "^0.59.4",
    "react-native-deprecated-custom-components": "^0.1.2",
    "react-native-root-toast": "^2.1.0",
    "react-native-scrollable-tab-view": "^0.6.0",
    "react-native-swipe-list-view": "^1.4.1",
    "react-native-tab-navigator": "^0.3.3",
    "react-native-vector-icons": "^4.6.0",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "redux-thunk": "^2.3.0",
    "whatwg-fetch": "^2.0.1"
  },
  "jest": {
    "preset": "react-native"
  },
  "devDependencies": {
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.3",
    "babel-jest": "23.4.2",
    "babel-preset-react-native": "5.0.1",
    "jest": "23.5.0",
    "react-test-renderer": "16.3.1"
  }
}


使用xcode进行编译

mac上可以将xcodeproj 的文件打开,然后再来进行编译,需要先编译React然后再编译Gank的话就可以成功

总结

所以可以看出来android和IOS的加载部分包还是有区别的。

要研究一下使用xcode来编译之后,那么如何debug呢