diff --git a/example/src/App.tsx b/example/src/App.tsx index 9a8acf4..dffc4f9 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -8,13 +8,13 @@ export default function App() { console.log('onValueChange', number)} onValueChangeEnd={(number) => console.log('onValueChangeEnd', number)} - unit="cm" /> ); diff --git a/src/components/RulerPicker.tsx b/src/components/RulerPicker.tsx index 28347a3..8d1f0d1 100644 --- a/src/components/RulerPicker.tsx +++ b/src/components/RulerPicker.tsx @@ -258,14 +258,13 @@ export const RulerPicker = ({ step, ] ); - const onContentSizeChange = useCallback(() => { + function onContentSizeChange() { const initialIndex = Math.floor((initialValue - min) / step); listRef.current?.scrollToOffset({ offset: initialIndex * (stepWidth + gapBetweenSteps), animated: false, }); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); + } return (