Skip to content

Commit

Permalink
fix(slider): 修复 sliderRef.current 可能为空的问题 (#2868)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZWkang authored Apr 26, 2024
1 parent f7706f8 commit 7287fdf
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/slider/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,8 @@ const Slider = React.forwardRef<HTMLDivElement, SliderProps>((originalProps, ref
};

const onSliderChange = (event: React.MouseEvent | MouseEvent, nodeIndex?: SliderHandleNode) => {
if (disabled) {
return;
}
if (disabled || !sliderRef.current) return;

const clientKey = isVertical ? 'clientY' : 'clientX';
const sliderPositionInfo = sliderRef.current.getBoundingClientRect();
const sliderOffset = sliderPositionInfo[startDirection];
Expand Down

0 comments on commit 7287fdf

Please sign in to comment.