I am using SketchPicker with onChangeCompelete and it feels cursor barely moves when i drag it.
Hello,
I believe you're supposed to use onChange instead of onChangeComplete if you want the smoother drag behaviour.
Indeed its much smoother thanks. But I want to have both smooth dragging and only send the action when the dragging stops
You could use both events, onChange for smooth dragging and onChangeComplete for sending the action.
<ColorPicker
onChange={(color) => {handleSmoothChange(color)}} //update in component only like for a button
onChangeComplete{(color) => {handleFinalSendAction(color)}} //actually send it to DOM
/>
Hello i m using onChange but still its not smooth for me
Please help me out
```
class ColorPickerDemo extends Component {
state = {
background: "#fff"
};
handleChangeComplete = color => {
this.setState({ background: color.hex });
};
render() {
return (
color={this.state.background}
onChange={this.handleChangeComplete}
/>
);
}
}
@Atmiya735 I changed my implementation to use onChange instead of onChangeComplete and it is not laggy anymore:
<ChromePicker
color={selectedColor}
onChange={(color: ColorResult) => setSelectedColor(color.hex)}
/>
@rodrigomf24 thats strange...onChange should be in fact lagging because it fires on each drag event, right?
Most helpful comment
@Atmiya735 I changed my implementation to use
onChangeinstead ofonChangeCompleteand it is not laggy anymore: