Make compatible with React 16
When I try to use the package with React 16, npm gives me this warning:
npm WARN [email protected] requires a peer of react@^0.14.8 || ^15.0.1 but none is installed. You must install peer dependencies yourself.
When I try to do a build with React 16, an error is thrown in the file: ./node_modules/react-phone-input/dist/index.js:
Uncaught TypeError: Cannot read property 'string' of undefined
The fix is pretty simple, just need to add prop-types as a dependency, import PropTypes from 'prop-types' and then use it instead of React.PropTypes
But I cannot build it on my system... strange webpack errors about unexpected chars in flags.png
@andreafdaf @adc17 I'll take a look over the weekend
@razagill any progress on this?
Ok it seems that this is already fixed in master, but not yet published to npm? just peerDependencies look strange:
npm WARN [email protected] requires a peer of peerDependencies@[object Object] but none was installed.
I'm having m.default.PropTypes is undefined error.
I have react@16 and [email protected] and I am using PropTypes via its own package.
@mgkaradag
This lib uses PropTypes as React.PropTypes (after bundling that syntax looks like m.default.PropTypes), but since you're using react@16 PropTypes is no longer inside React, hence the error... having prop-types as a dependency on your project doesn't change the issue
If you must use this lib you cannot use react >= 16 until it gets fixed, if you want to fix it yourself the fix is in my previous comment :v:
PS: if you can rebuild it after the fix (I couldn't, some versioning conflicts in webpack probably) could you please make a PR or publish your fork somewhere? :smile:
This still isn't fixed