搜索

首页  >  问答  >  正文

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"
    }
}
巴扎黑巴扎黑2707 天前1729

全部回复(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
  • 取消回复