🐛 fix: fix slider onchange not correctly (#265)

This commit is contained in:
Arvin Xu
2025-02-15 19:33:25 +08:00
committed by GitHub
parent 796500d264
commit 8986fc7230
+3 -3
View File
@@ -3,7 +3,7 @@
import { InputNumber, type InputNumberProps, Slider } from 'antd';
import { SliderSingleProps } from 'antd/es/slider';
import { isNull } from 'lodash-es';
import { memo, useCallback } from 'react';
import { memo } from 'react';
import { CommonSpaceNumber, Flexbox } from 'react-layout-kit';
export interface SliderWithInputProps extends SliderSingleProps {
@@ -28,10 +28,10 @@ const SliderWithInput = memo<SliderWithInputProps>(
disabled,
...rest
}) => {
const handleOnchange = useCallback((value: number | null) => {
const handleOnchange = (value: number | null) => {
if (Number.isNaN(value) || isNull(value)) return;
onChange?.(value);
}, []);
};
return (
<Flexbox