react-color
react-color copied to clipboard
CustomPicker does not work in modern React
Seems like there is a problem with CustomPicker higher-order component in React 16+. Can CustomPicker be used in React v16?
Works with React v15.6.1 https://codesandbox.io/s/custom-picker-old-react-forked-o9770
Does not work with React v16.12.0 https://codesandbox.io/s/custom-picker-new-react-ur2z4
Same problem here, would love to have a hot-fix on this.
Commenting getDerivedStateFromProps in ColorWrap.js has fixed the problem for me

but I am not fully aware of the root cause, there is one related thread, where it mentioned that there is a dev-dependencies on an older version of react
Root cause is #662 , componentWillReceiveProps can't be changed to getDerivedStateFromProps just like that.
Note that this method is fired on every render, regardless of the cause. This is in contrast to UNSAFE_componentWillReceiveProps, which only fires when the parent causes a re-render and not as a result of a local setState.
v2.17.3 works for me
@hzhu @tazhel if you listen onChange and provide the changed colour to colorpicker through color props then it is working fine, Here is the working codeSandBox Project forked from your one.

basically it is working in a controlled mode, not in AutoControlled mode or It is kind od providing your own CustomWrapper over color-picker instead of using ColorWrap
Seems like there is a problem with
CustomPickerhigher-order component in React 16+. CanCustomPickerbe used in React v16?Works with React v15.6.1 https://codesandbox.io/s/custom-picker-old-react-forked-o9770
Does not work with React v16.12.0 https://codesandbox.io/s/custom-picker-new-react-ur2z4
Any solutions on this one?
The same problem with ChromePicker and SketchPicker.
"react": "16.13.1",
"react-dom": "16.13.1",
"react-color": "2.19.3"
Any update on this thread ?
Fix provided in #791