Skip to content

Commit

Permalink
Merge pull request #709 from southorange1228/fix_slider_demo
Browse files Browse the repository at this point in the history
fix(slider): fix uncontrolled mode can't change value
  • Loading branch information
honkinglin authored Apr 29, 2022
2 parents 2326c0e + e6a11c1 commit cdc45f5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/slider/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const Slider = forwardRef<HTMLDivElement, SliderProps>(
range,
step = 1,
tooltipProps,
value: propsValue = min,
defaultValue,
value: propsValue,
defaultValue = min,
onChange,
className,
style,
Expand Down Expand Up @@ -121,7 +121,11 @@ const Slider = forwardRef<HTMLDivElement, SliderProps>(
return (
<InputNumber
value={currentValue}
onChange={(value: number) => handleInputChange(Number(value), nodeIndex)}
onChange={(v: number) => {
if (typeof v !== 'undefined') {
handleInputChange(Number(v), nodeIndex);
}
}}
className={classNames(`${classPrefix}-slider-input`, {
'is-vertical': isVertical,
})}
Expand Down

0 comments on commit cdc45f5

Please sign in to comment.