React-native-web: Error: undefined is not an object (evaluating 'EventPluginHub.injection') on [email protected]

Created on 7 Sep 2018  路  8Comments  路  Source: necolas/react-native-web

Hi guys,

I just ran into this problem and thought I'd let you know. I'll try and dig into it a little more, but just in case someone else runs into it or wants to pick it up

The problem

React Native Web doesn't work with [email protected]

It seems that React DOM has removed some functionality that React Native Web requires

undefined is not an object (evaluating 'EventPluginHub.injection')

Which is likely due to https://github.com/facebook/react/pull/13539 causing it to fail here https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/exports/createElement/index.js#L17-L21

How to reproduce

https://codesandbox.io/s/542j6l8m8x

Expected behavior

That it all looks pretty

Environment (include versions). Did this work in previous versions?

  • React Native for Web (version): 0.8.*
  • React (version): 16.5.0
  • Browser: Any

Cheers,
Jeremy

Most helpful comment

All 8 comments

Thanks

Waiting for React to put out a patch release reintroducing the API. RNW 0.9.0 will be compatible with React 16.5.x

Using RNW 0.8.10 and RN 16.5.1 -- still not working for me. Same error

I also checked that in my node_module/react I have the 16.5.1 package.json -- and I do.
setting react, react-dom, react-art to 16.4.2 fixes, the problem in the mean time, for me.

my package json:

{
  "name": "wrnw-csr-cra",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "babel-polyfill": "^6.26.0",
    "bootstrap": "^3.3.7",
    "compression": "^1.7.3",
    "hi-base32": "^0.5.0",
    "immutable": "3.8.2",
    "lodash": "^4.17.10",
    "prop-types": "^15.6.2",
    "pubsub-js": "^1.6.1",
    "react": "^16.5.1",
    "react-art": "^16.5.1",
    "react-bootstrap": "^0.32.4",
    "react-dom": "^16.5.1",
    "react-dropzone-component": "^3.2.0",
    "react-native-vector-icons": "^5.0",
    "react-native-web": "^0.8.10",
    "react-router-dom": "^4.3.1",
    "react-scripts": "1.1.5",
    "resize-observer-polyfill": "^1.5.0",
    "tree-model": "^1.0.7",
    "url-search-params-polyfill": "^4.0.0"
  },
  "scripts": {
    "analyze": "source-map-explorer build/static/js/main.*",
    "flow": "$(npm bin)/flow",
    "flow start": "$(npm bin)/flow start",
    "flow stop": "$(npm bin)/flow stop",
    "flow status": "$(npm bin)/flow status",
    "flow coverage": "$(npm bin)/flow coverage",
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "ostart": "react-app-rewired start",
    "obuild": "react-app-rewired build",
    "otest": "react-app-rewired test --env=jsdom",
    "postinstall": "$(npm bin)/flow-typed install"
  },
  "devDependencies": {
    "babel-eslint": "^9.0.0",
    "eslint": "^5.5.0",
    "eslint-config-react-native": "^3.0.0",
    "eslint-plugin-flowtype": "^2.50.0",
    "eslint-plugin-react": "^7.11.1",
    "eslint-plugin-react-native": "^3.2.1",
    "flow-bin": "^0.80",
    "flow-typed": "^2.5.1",
    "jest": "^23.5.0",
    "jest-cli": "^23.5.0",
    "react-app-rewired": "^1.6.2",
    "source-map-explorer": "^1.6.0",
    "treeify": "^1.1.0",
    "webpack-merge": "^4.1.4"
  }
}

The error stack trace

react-16 5 1-showstopper-rnw

It wouldn't work until React Native Web merges the corresponding fix. :-)

@gaearon , thank you. It seems I misunderstood the relations of what was being closed/fixed and where.

@necolas Do you have an ETA on this fix?

Was this page helpful?
0 / 5 - 0 ratings