首頁  >  問答  >  主體

javascript - React Native 錯誤:評估 ReactInternals.ReactCurrentOwner

react-native run-android 如下報錯誤

undefined is not an object evaluating ReactInternals.ReactCurrentOwner

如下圖:

預計原因是RN版本的問題。

參考:
https://github.com/facebook/r...

#解決辦法

As I mentioned, make sure you've installed the correct version of React. If you're using React Native 0.45:
yarn add react@16.0.0-alpha.12

【參考了解決方法,還是沒解決問題,不知道現在該怎麼辦了。出現這個問題是什麼原因?要怎麼解決? 】

以下是我的package.jason檔案。

{
    "name": "ReactNativeWeb",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
    },
    "dependencies": {
        "babel-core": "^6.25.0",
        "babel-loader": "^7.0.0",
        "babel-preset-es2015": "^6.24.1",
        "babel-preset-react": "^6.24.1",
        "react": "^16.0.0-alpha.12",
        "react-dom": "^16.0.0-alpha.12",
        "react-native": "^0.45.1",
        "react-native-web": "0.0.103",
        "webpack": "^2.6.1"
    },
    "devDependencies": {
        "babel-jest": "20.0.3",
        "babel-preset-react-native": "2.0.0",
        "jest": "20.0.4",
        "react-test-renderer": "16.0.0-alpha.12",
        "webpack-dev-server": "^2.4.5"
    },
    "jest": {
        "preset": "react-native"
    }
}
巴扎黑巴扎黑2693 天前1713

全部回覆(2)我來回復

  • 巴扎黑

    巴扎黑2017-06-26 10:52:21

    最終降低react版本解決了問題

    回覆
    0
  • ringa_lee

    ringa_lee2017-06-26 10:52:21

    我也遇到這個問題,透過官方react-native-git-upgrade升級,react:16.0.0-alpha.12,react-native:0.45.1,報錯Module AppRegistry is not a registered callable module (calling runApplication)
    現在用回以前的react:16.0.0-alpha.6,react-native:0.43.4也報這個錯了,不知道怎麼解決了
    我也想問rn版本升級到底有多大好處,我覺得升級一次帶來的問題很多

    回覆
    0
  • 取消回覆