undefined不是对象(正在评估'Component.propTypes')-React Native 0.61.5

时间:2019-12-24 06:46:27

标签: javascript ios react-native

我已经将现有的react native项目从react native 0.59.6升级到0.61.5。

react-native升级命令不起作用。因此,我已经使用升级助手完成了手动升级。解决了一些帖子问题。现在,项目构建成功。

但是从Xcode渲染到ios模拟器后,它会出现以下错误。

iPhone XR emulator screenshot

我没有在任何地方使用Component.propTypes。 package.lock.json有一些带有prop-types的软件包。我不确定它到底在做什么。否则,在我的项目中,我没有使用 道具型也。请在下面找到我的package.lock.json,

package.lock.json

...
...
...

 "prop-types": {
      "version": "15.7.2",
      "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.7.2.tgz",
      "integrity": "sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ==",
      "requires": {
        "loose-envify": "^1.4.0",
        "object-assign": "^4.1.1",
        "react-is": "^16.8.1"
      }
    },
....
"react": {
      "version": "16.9.0",
      "resolved": "https://registry.npmjs.org/react/-/react-16.9.0.tgz",
      "integrity": "sha512-+7LQnFBwkiw+BobzOF6N//BdoNw0ouwmSJTEm9cglOOmsg/TMiFHZLe2sEoN5M7LgJTj9oHH0gxklfnQe66S1w==",
      "requires": {
        "loose-envify": "^1.1.0",
        "object-assign": "^4.1.1",
        "prop-types": "^15.6.2"
      }
    },
....

package.json

{
  "name": "wasfat",
  "version": "1.0.3",
  "private": true,
  "rnpm": {
    "assets": [
      "app/assets/fonts/corbel"
    ]
  },
  "scripts": {
    "prepare-repository": "npm i -g react-native-cli yarn;yarn install; react- native link",
    "emulator": "emulator -avd Nexus5V6L23_x86_64 -scale 1.0",
    "clean": "watchman watch-del-all && npm cache clean && cd android && ./gradlew clean && cd ..",
    "test": "jest",
    "postinstall": "rm -rf node_modules/react-native-twitter-signin/node_modules",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "lint": "eslint ."
  },
  "dependencies": {
    "jetifier": "^1.6.5",
    "react": "16.9.0",
    "react-native": "^0.61.5",
    "react-native-actionsheet": "^2.4.2",
    "react-native-android-keyboard-adjust": "^1.2.0",
    "react-native-aws3": "0.0.8",
    "react-native-deep-linking": "^2.2.0",
    "react-native-device-info": "^5.3.1",
    "react-native-double-tap": "^1.0.1",
    "react-native-drawer": "^2.5.1",
    "react-native-elements": "^1.0.0",
    "react-native-exception-handler": "^2.10.8",
    "react-native-fbsdk": "^1.1.0",
    "react-native-firebase": "^5.5.6",
    "react-native-gesture-handler": "^1.1.0",
    "react-native-google-signin": "^1.2.3",
    "react-native-hide-with-keyboard": "^1.2.0",
    "react-native-image-crop-picker": "^0.25.3",
    "react-native-image-picker": "^0.28.1",
    "react-native-image-slider": "^2.0.3",
    "react-native-image-view": "^2.1.5",
    "react-native-keyboard-avoiding-view": "^1.0.0",
    "react-native-keyboard-aware-scroll-view": "^0.8.0",
    "react-native-keyboard-aware-scrollview": "^2.0.0",
    "react-native-keyboard-aware-view": "0.0.14",
    "react-native-keyboard-listener": "^1.1.0",
    "react-native-modal": "^11.1.0",
    "react-native-paper": "^2.15.0",
    "react-native-picker-select": "^6.2.0",
    "react-native-popup-menu": "^0.15.6",
    "react-native-progress": "^3.6.0",
    "react-native-read-more-text": "^1.1.0",
    "react-native-responsive-image": "^2.3.1",
    "react-native-responsive-screen": "^1.2.1",
    "react-native-s3-upload": "0.0.12",
    "react-native-share": "^1.2.1",
    "react-native-side-drawer": "^1.1.9",
    "react-native-side-menu": "^1.1.3",
    "react-native-simple-toast": "0.0.8",
    "react-native-snap-carousel": "^3.8.0",
    "react-native-swiper-flatlist": "^1.0.10",
    "react-native-twitter-signin": "^1.1.1",
    "react-native-vector-icons": "^6.6.0",
    "react-native-video": "^4.4.4",
    "react-native-video-controls": "^2.2.3",
    "react-native-video-player": "^0.10.0",
    "react-native-view-more-text": "^2.1.0",
    "react-navigation": "^3.3.0",
    "react-redux": "^7.1.0",
    "react-spinkit": "^3.0.0",
    "redux": "^4.0.4"
  },
  "devDependencies": {
    "@babel/core": "^7.6.2",
    "@babel/runtime": "^7.6.2",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.5.1",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.56.0",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

我已经找到有关此问题的https://reactjs.org/warnings/dont-call-proptypes.html。但是我不确定如何使用它。因为据此。一些第三方库直接使用propTypes。但是如何处理呢?

0.61版本的Github问题没有帮助。请提出一些解决此问题的方法。

感谢您的帮助。

0 个答案:

没有答案