Skip to content

Commit

Permalink
fix: removed unnecessary useCallback usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Skipperlla authored and enestatli committed Jul 31, 2023
1 parent 46190bc commit 0909df8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ export default function App() {
<View style={styles.container}>
<RulerPicker
min={0}
unit="cm"
max={240}
step={1}
fractionDigits={0}
initialValue={0}
onValueChange={(number) => console.log('onValueChange', number)}
onValueChangeEnd={(number) => console.log('onValueChangeEnd', number)}
unit="cm"
/>
</View>
);
Expand Down
5 changes: 2 additions & 3 deletions src/components/RulerPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<View style={{ width, height }}>
Expand Down

0 comments on commit 0909df8

Please sign in to comment.