Skip to content

Commit 0909df8

Browse files
Skipperllaenestatli
authored andcommitted
fix: removed unnecessary useCallback usage
1 parent 46190bc commit 0909df8

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

example/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ export default function App() {
88
<View style={styles.container}>
99
<RulerPicker
1010
min={0}
11+
unit="cm"
1112
max={240}
1213
step={1}
1314
fractionDigits={0}
1415
initialValue={0}
1516
onValueChange={(number) => console.log('onValueChange', number)}
1617
onValueChangeEnd={(number) => console.log('onValueChangeEnd', number)}
17-
unit="cm"
1818
/>
1919
</View>
2020
);

src/components/RulerPicker.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,14 +258,13 @@ export const RulerPicker = ({
258258
step,
259259
]
260260
);
261-
const onContentSizeChange = useCallback(() => {
261+
function onContentSizeChange() {
262262
const initialIndex = Math.floor((initialValue - min) / step);
263263
listRef.current?.scrollToOffset({
264264
offset: initialIndex * (stepWidth + gapBetweenSteps),
265265
animated: false,
266266
});
267-
// eslint-disable-next-line react-hooks/exhaustive-deps
268-
}, []);
267+
}
269268

270269
return (
271270
<View style={{ width, height }}>

0 commit comments

Comments
 (0)