wangzuo / input-moment

React datetime picker powered by momentjs
https://wangzuo.github.io/input-moment
ISC License
527 stars 173 forks source link

PropTypes via the main React package is deprecated #77

Closed thewashingtonhua closed 6 years ago

thewashingtonhua commented 6 years ago

Not a big problem (for now). But WILL be when React 16.0 is official (which won't take long).

Just switch to independent 'prop-types' package and everything will be OK.

Official warning goes like this: Accessing PropTypes via the main React package is deprecated, and will be removed in React v16.0. Use the latest available v15.* prop-types package from npm instead. For info on usage, compatibility, migration and more, see https://fb.me/prop-types-docs

wangzuo commented 6 years ago

Where did you get the proptypes warning?

thewashingtonhua commented 6 years ago

in chrome developer tool.

'prop-types' has been an independent package for quite a while. and I've been using it this way in my recent projects. the team added this warning in several releases ago. you can find that in the release note.

for react 15.x and before. current code still works. but react 16 (which will be launched in days) won't support this syntax any more. guess you might wanna make some updates.

wangzuo commented 6 years ago

Are you sure the warning is from input-moment ?

thewashingtonhua commented 6 years ago

I took a deep look at your code. your code seems fine. But they depend on a quite old version of 'react-input-slider' (3.0.0. latest version is 8.3.1) which was using React.PropTypes. That caused the problem. But from the surface, the warning came when I included your package.

The latest code has been rewritten in the recommended way. How about some yarn upgrade ?

FYI. This also caused issue #60 .

wx20170926-175506

wangzuo commented 6 years ago

I recommend upgrading input-moment to the latest version, react-input-slider@3.0.0 doesnt use React.PropTypes either.

thewashingtonhua commented 6 years ago

Thank you. with 0.3.6 the problem is no more.

I was using 0.3.5 until last minute. In that version it depends on 'react-input-slider' 1.5.0 (according to your commit record). I saw you adopted 'prop-types' in 2.0.0 with a 'es6 fix' commit. That solved the problem.

BTW, about that 'react-input-slider 8.3.1'. Someone had a package with very similar name to yours (input-slider-react). The search engine gave me that instead of yours. Hence the misunderstanding. Sorry to bother, and thanks again to you work. Very helpful !