Skip to content

Commit

Permalink
fix: onAfterChange should not trigger when click on track
Browse files Browse the repository at this point in the history
  • Loading branch information
MadCcc committed Nov 29, 2023
1 parent fa77b3e commit 49e9d35
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions docs/examples/debug.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ export default () => {
console.log('Change:', nextValues);
// setValue(nextValues as any);
}}
onAfterChange={(v) => {
console.log('AfterChange:', v);
}}
// value={value}

min={0}
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/marks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default () => (
<div>
<div style={style}>
<p>Slider with marks, `step=null`</p>
<Slider min={-10} marks={marks} step={null} onChange={log} defaultValue={20} />
<Slider min={-10} marks={marks} step={null} onChange={log} defaultValue={20} onAfterChange={(v) => console.log('AfterChange:', v)} />
</div>

<div style={style}>
Expand Down
1 change: 0 additions & 1 deletion src/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ const Slider = React.forwardRef((props: SliderProps, ref: React.Ref<SliderRef>)

onBeforeChange?.(getTriggerValue(cloneNextValues));
triggerChange(cloneNextValues);
onAfterChange?.(getTriggerValue(cloneNextValues));
if (e) {
onStartDrag(e, valueIndex, cloneNextValues);
}
Expand Down

0 comments on commit 49e9d35

Please sign in to comment.