【问题标题】:React Native 0.56 crashes at start upReact Native 0.56 在启动时崩溃
【发布时间】:2018-07-23 21:11:52
【问题描述】:

从版本 0.44 -> 0.56 升级后,我在第一个渲染循环中一直得到这个。有任何想法吗? (似乎是一个内部反应原生错误)。谷歌搜索没有给我任何东西:-(

TypeError: undefined is not an object (evaluating 'props.getItem')

This error is located at:
    in FlatList (at YellowBoxList.js:87)
    in RCTView (at View.js:43)
    in YellowBoxList (at YellowBox.js:104)
    in YellowBox (at AppContainer.js:93)
    in RCTView (at View.js:43)
    in AppContainer (at renderApplication.js:31)

_checkProps
    FlatList.js:489:6

package.json - 所有包都是最新的(yarn upgrade --latest)。我正在使用一些 custom 包来处理其他 rn 0.56.0 问题。比如react-native-root-siblings不兼容babel7。

 "dependencies": {
    "assert": "1.4.1",
    "lodash": "4.17.10",
    "moment": "2.22.2",
    "moment-range": "4.0.1",
    "path": "^0.12.7",
    "prop-types": "^15.6.2",
    "react": "^16.4.1",
    "react-native": "^0.56.0",
    "react-native-action-button": "2.8.4",
    "react-native-actionsheet": "2.4.2",
    "react-native-animatable": "1.3.0",
    "react-native-autocomplete-input": "3.5.0",
    "react-native-background-timer": "2.0.1",
    "react-native-branch": "2.3.2",
    "react-native-code-push": "5.4.0",
    "react-native-collapsible": "0.13.0",
    "react-native-config": "0.11.5",
    "react-native-contacts-wrapper": "0.2.4",
    "react-native-country-picker-modal": "0.6.2",
    "react-native-datepicker": "1.7.2",
    "react-native-device-info": "0.22.0",
    "react-native-dotenv": "0.2.0",
    "react-native-fast-image": "^4.0.14",
    "react-native-fbsdk": "0.7.0",
    "react-native-fcm": "^16.0.0",
    "react-native-firebase": "^4.3.5",
    "react-native-fs": "2.10.14",
    "react-native-fullwidth-image": "^0.1.2",
    "react-native-htmlview": "0.12.1",
    "react-native-i18n": "2.0.15",
    "react-native-image-crop-picker": "0.20.3",
    "react-native-image-gallery": "2.1.5",
    "react-native-intercom": "11.1.0",
    "react-native-keyboard-aware-scroll-view": "0.6.0",
    "react-native-linear-gradient": "2.4.0",
    "react-native-loading-spinner-overlay": "0.5.2",
    "react-native-mail": "3.0.6",
    "react-native-modal-datetime-picker": "6.0.0",
    "react-native-offline": "3.11.0",
    "react-native-permissions": "1.1.1",
    "react-native-phone-input": "0.2.1",
    "react-native-picker": "4.3.7",
    "react-native-popup-dialog": "0.14.52",
    "react-native-restart": "git+https://github.com/nmchr7/react-native-restart.git#master",
    "react-native-root-toast": "https://github.com/swapkids/react-native-root-toast.git#master",
    "react-native-segment-analytics": "0.1.14",
    "react-native-side-menu": "1.1.3",
    "react-native-simple-store": "1.3.0",
    "react-native-spinkit": "1.1.1",
    "react-native-splash-screen": "3.1.0",
    "react-native-swipeable": "0.6.0",
    "react-native-tooltips": "0.0.6",
    "react-native-vector-icons": "4.6.0",
    "react-navigation": "2.9.0",
    "react-redux": "5.0.7",
    "redux": "4.0.0",
    "redux-persist": "5.10.0",
    "redux-saga": "0.16.0",
    "remote-redux-devtools": "0.5.12",
    "replace-ext": "^1.0.0",
    "rn-viewpager": "1.2.9",
    "rrule": "2.2.9",
    "socket.io-client": "2.1.1",
    "uuid": "^3.2.1",
    "validator": "10.4.0"
  }

【问题讨论】:

  • 您可能需要升级其他依赖项。在终端尝试yarn upgrade --latest
  • 没有帮助。所有软件包都是最新的。仍然收到错误 :-( 你想看看我的 package.json 文件吗?
  • 当然,将其添加到您的问题中
  • 完成^^^^^^^^^^
  • 这么多包,你有没有更多的错误信息。比如同时显示终端错误和模拟器错误。

标签: react-native


【解决方案1】:

我看到了同样的错误,对我来说,解决方案是消除所有旧的 babel-* devDependencies,删除 node_modules,然后运行 ​​yarn 来重建它。我剩下的唯一与 babel 相关的包(现在它正在工作)是 "@babel/plugin-proposal-decorators": "7.0.0-beta.47", "babel-jest": "23.4.2", "babel-preset-react-native": "^5" 最后两个是 react-native init 为新项目放在那里的,第一个是我添加的,因为我使用了装饰器。

【讨论】:

    【解决方案2】:

    我通过运行解决了它

    react-native start --reset-cache
    

    然后

    react-native run-android

    【讨论】:

      【解决方案3】:

      这是 0.56 的错误。 去 0.54 你不会有任何问题 使用这个命令:

      react-native init --version="0.54.0" ProjectName
      

      我遇到了同样的问题,它对我很有用。 check this out

      【讨论】:

      • 我在 0.58.3 有这个。
      猜你喜欢
      • 2021-10-25
      • 2018-12-16
      • 1970-01-01
      • 2021-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多