airbnb/rheostat

onSliderDragStart and onSliderDragEnd handlers affect onChange function parameters

designbyadrian opened this issue · 2 comments

Steps to reproduce

Have onChange, onSliderDragStart, and onSliderDragEnd handlers on Rheostat component.

Drag a handle to new position.

Expected result

onChange is called with values [newValue, newValue]

Actual result

onChange is called with values [oldValue, oldValue]

I had state changes in all three, which overwrote each other. My mistake.

handleChange = ({ values }) => {
    this.setState({ values });
}

handleStart = () => {
    this.setState({ dragging: true });
}

handleEnd = () => {
    this.setState({ dragging: false });
}

onSliderDragEnd and onChange collide. Use one or the other.