react-color icon indicating copy to clipboard operation
react-color copied to clipboard

Sketch Picker does not reflect color change on click nor drag

Open TejaReddy7 opened this issue 4 years ago • 6 comments

Hi I am unable to pick color and values doesn't change, I am attaching code snippet and image, this bug raised recently using react 16.12.0 version.

ezgif com-video-to-gif (1)

onComplete = (param) => { const hexVal = param.hex || param.target.value; this.props.brandingColor.originalHexColorCode = this.props.brandingColor.hexColorCode; this.props.brandingColor.hexColorCode = hexVal; this.setState({ color: param.rgb }); this.props.updateColor(this.props.colors, this.props.brandingColor); };

SketchPicker color={this.state.color} onChangeComplete={this.onComplete} disableAlpha={true} presetColors={this.getHexValues()} />

TejaReddy7 avatar Sep 11 '20 13:09 TejaReddy7

I'm having the same issue with ChromePicker. React 16.13.1

{isOpen ? <ChromePicker color={value} onChange={handleChange} /> : null}

ahoys avatar Oct 06 '20 05:10 ahoys

I'm having the same issue, unfortunately. React 16.13.1

watcher00090 avatar Oct 09 '20 01:10 watcher00090

Same here. React 16.13.1

Edit- ok, it works in controlled mode, so work done for now.

zehawki avatar Oct 21 '20 14:10 zehawki

I am having same problem. Is this solved? React 17.0.2 and I am using React Hooks.

m-rojen avatar Jul 20 '21 12:07 m-rojen

I had the same issue. The color picker has to be repainted based on a new color. Use a state to do that :

  const [sketchPickerColor, setSketchPickerColor] = useState<RGBColor>({
        r: 241,
        g: 112,
        b: 19,
        a: 1,
    });

    return (
            <SketchPicker
                onChange={(color) => {
                    setSketchPickerColor(color.rgb);
                }}
                color={sketchPickerColor}
            />
    )

ericjeansmith avatar Dec 14 '22 15:12 ericjeansmith