Nativebase: React Native 0.38.0-rc.0 - Unable to resolve module react/lib/ReactNativePropRegistry from /project/node_modules/native-base/Components/Widgets/Button.js

Created on 19 Nov 2016  路  16Comments  路  Source: GeekyAnts/NativeBase

Tried upgrading to React Native 0.37.0 and got this error: https://github.com/facebook/react-native/issues/11004

Upgraded to React Native 0.38.0-rc.0and got past that error, now getting error from Native Base:

Unable to resolve module react/lib/ReactNativePropRegistry from /project/node_modules/native-base/Components/Widgets/Button.js
    "native-base": "0.5.15",
    "react": "15.4.0",
    "react-native": "0.38.0-rc.0",

EDIT:

    "native-base": "0.5.15",
    "react": "15.3.2",
    "react-dom": "15.3.2",
    "react-native": "0.37.0",

Works for me.

Most helpful comment

Actually, the following work:

import { ReactNativePropRegistry } from 'react-native';

OR

var ReactNativePropRegistry = require{'react-native'};

So, it seems that ReactNativePropRegistry is indeed publicly exposed now, but it should not be referenced with an absolute path.

This needs to be fixed in:

NativeBase
Components/Widgets/Button.js
Utils/computeProps.js

react-native-easy-grid
Utils/computeProps.js

All 16 comments

Hi, can I check with you:

  1. It is still incompatible with latest react v15.4.0, so either React or Nativebase has to fix it, right? Should not we leave the issue open?

  2. Is ReactDOM needed ?

Thank you. Cheers

@tzyhhaur I reopened it for you. I believe React DOM is needed: https://facebook.github.io/react/blog/2016/11/16/react-v15.4.0.html#separating-react-and-react-dom

Getting this error as well with react-native 0.38.

Actually, the following work:

import { ReactNativePropRegistry } from 'react-native';

OR

var ReactNativePropRegistry = require{'react-native'};

So, it seems that ReactNativePropRegistry is indeed publicly exposed now, but it should not be referenced with an absolute path.

This needs to be fixed in:

NativeBase
Components/Widgets/Button.js
Utils/computeProps.js

react-native-easy-grid
Utils/computeProps.js

Fixed with latest release 0.5.18

@SupriyaKalghatgi im using this version :
"native-base": " 0.5.18", "react": "15.3.2", "react-native": "0.35.0",
and its still the same.

@thundenilla Please make sure of package versions

  • If you want to work with RN < 0.38 then you should go for NB < 0.5.16
  • For RN >= 0.38, NB 0.5.18 is compatible

#336

this is still happening right now
"dependencies": { "@expo/vector-icons": "5.0.0", "expo": "^18.0.3", "native-base": "2.2.1", "react": "16.0.0-alpha.12", "react-native": "^0.45.1" }

@Solitaryo Please check this

I get the same error just like Solitaryo , i check the link still can't figure it out . Can you explain why , shivrajkumar. That would be appreciated.

Hey , try to remove "native-base": "^2.2.1", npm uninstall --save native-base and reinstall 2.2.0

npm install --save [email protected]

It can solve the issue for now.

@monodop RN keeps changing the path of ReactNativePropRegistry. They changed the path in RN 0.38.x and again now its changed in RN 0.46.x. It is an internal API, so it has to be imported from absolute path. Thus NativeBase v2.2.1 has been updated with the new path which works for RN 46.
For RN < 46, go for NativeBase 2.2.0

Now i know what's going on , thanks shivrajkumar

@shivrajkumar I came to this issue from another ReactNativePropRegistry issue which was basically, my computeProps.js would change the import path (from "react-native/Libraries/Renderer/src/renderers/native/ReactNativePropRegistry" to 'react-native/libraries/Renderer/shims/ReactNativePropRegistry)would you be able to explain why even if i have the compatabilities "native-base": "^2.1.5", and "react-native": "^0.44.0", and after I change the incorrect path back to the original path that the error still pops up sometimes when I re run the project? This also happens to me with another module and it keeps happening and its so extremely frustrating

@shivrajkumar , can you update the dependencies so the wrong version of native-base doesn't get installed with the wrong version of react-native? All I do is "yarn add native-base", and it doesn't properly update the react-native to the version needed. Manually downgrading/upgrading (ignoring what the dependencies handle) isn't a solution.

Can you please update the docs:
https://docs.nativebase.io/docs/GetStarted.html

Was this page helpful?
0 / 5 - 0 ratings

Related issues

inv2004 picture inv2004  路  3Comments

agersoncgps picture agersoncgps  路  3Comments

aloifolia picture aloifolia  路  3Comments

elnygren picture elnygren  路  3Comments

maphongba008 picture maphongba008  路  3Comments