am trying to connect the react component with my native android app(Time being am experimenting with hello world project ) but its failing with following error. Any help would be appreciated.
Pkg.json config
"react": "^16.0.0-alpha.6",
"react-dom": "^15.6.1",
"react-native": "^0.44.0",
"react-native-web": "0.0.103",
"webpack": "^2.6.1"
StackTrace
bundling: UnableToResolveError: Unable to resolve module react/lib/ReactPropTypes from /Users/myMac/Documents/Androidapps/TestReactNative/node_modules/react-native/Libraries/Image/Image.android.js: Module does not exist in the module map or in these directories:
I'm getting the same error.
Why the issue was closed? Is there any solution for this issue that I'm missing?
Thanks,
Joao
"dependencies": {
"native-base": "^2.1.4",
"react": "^16.0.0-alpha.12",
"react-native": "^0.44.0",
"react-native-calendars": "^1.4.0",
"react-native-camera": "git+https://github.com/lwansbrough/react-native-camera.git",
"react-native-checkbox": "^1.1.0",
"react-native-fcm": "^6.2.0",
"react-native-fetch-blob": "^0.10.5",
"react-native-image-picker": "^0.26.3",
"react-native-localization": "^0.1.29",
"react-native-modal-dropdown": "^0.4.2",
"react-native-modal-picker": "0.0.16",
"react-native-pdf-view": "git+https://github.com/cnjon/react-native-pdf-view.git",
"react-native-popup-dialog": "^0.7.22",
"react-native-side-menu": "^0.20.1",
"react-native-tabs": "^1.0.9",
"react-native-vector-icons": "^4.0.0",
"react-navigation": "git+https://github.com/react-community/react-navigation.git",
"uuid": "^3.0.1"
},
You need to require PropTypes from the prop-types package, not react now.
Im not using PropTypes anywhere in my code and I am having this issue too. Do we need to update react or react-native?
My package.json
"dependencies": {
"axios": "^0.16.1",
"firebase": "^3.6.6",
"native-base": "^2.1.4",
"prop-types": "^15.5.10",
"react": "^16.0.0-alpha.6",
"react-native": "^0.44.0",
"react-native-fbsdk": "0.6.0",
"react-native-i18n": "^1.0.0",
"react-native-router-flux": "^3.37.0",
"react-native-vector-icons": "^4.0.0",
"react-redux": "^5.0.1",
"redux": "^3.6.0",
"redux-persist": "^4.4.0",
"redux-promise": "^0.5.3",
"redux-thunk": "^2.1.0"
}
If any of your dependencies are using React.PropTypes they will need to be updated too so I would recommend auditing your dependencies (and their dependencies, etc.).
Hello,
So, apparently, in the React 16 we still have it, but it's deprecated. (will be removed in the next version of the react?
)
What worked for me was to do (I'm also using a similar configuration as Cotel is using):
"native-base": "^2.1.4",
"react": "^16.0.0-alpha.6",
"react-native": "^0.44.0",
"react-native-calendars": "^1.4.0", // This is the component that was causing the error
was calling this command:
npm install [email protected] --save
Not sure why, but after running this command, in my case worked. I think that the --save option makes it global and this made the trick to get away from the error.
I know that the correct would be to fix the React.PropTypes, but once that the component was installed via npm, I would prefer not touch the node_modules.
Cheers,
Joao
The issue comes from the little caret in your package.json, the ^
Since it matches all minor versions, if you let the caret in 16.0.0-alpha.6 and do npm i, it will install 16.0.0-alpha.12 or the latest.
If you remove it in your package.json like this :
"react": "16.0.0-alpha.6",
"react-native": "0.44.0",
It will install EXACTLY the same version as written, and since alpha 6 and 12 import prop-types differently, the problem surely comes from here.
PS : Doing npm i -S [email protected] is just a trick to force npm to install the alpha v6 but you don't need the trick if you modify your package.json accordingly
@VinceBT are we need to remove the ^ for react and react-native or for all dependencies?
Just for react and react-native, but is this issue still relevant today ?
@VinceBT Yes I am getting this issue. I am using follwoing version
"react": "16.0.0-alpha.12",
"react-native": "0.44.3",
Most helpful comment
The issue comes from the little caret in your package.json, the
^Since it matches all minor versions, if you let the caret in
16.0.0-alpha.6and donpm i, it will install16.0.0-alpha.12or the latest.If you remove it in your package.json like this :
It will install EXACTLY the same version as written, and since alpha 6 and 12 import prop-types differently, the problem surely comes from here.
PS : Doing
npm i -S [email protected]is just a trick to force npm to install the alpha v6 but you don't need the trick if you modify your package.json accordingly