Skip to content

Commit

Permalink
fix: time picker issue on android
Browse files Browse the repository at this point in the history
  • Loading branch information
farhoudshapouran committed Feb 1, 2025
1 parent 5754276 commit b9569cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-ui-datepicker",
"version": "2.0.5",
"version": "2.0.6",
"description": "Customizable date picker for React Native",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
6 changes: 4 additions & 2 deletions src/components/TimePicker/wheel-picker/wheel-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
ViewProps,
FlatListProps,
FlatList,
Platform,
} from 'react-native';
import styles from './wheel-picker.style';
import WheelPickerItem from './wheel-picker-item';
Expand Down Expand Up @@ -109,8 +110,9 @@ const WheelPicker: React.FC<Props> = ({
* This ensures that what the user sees as selected in the picker always corresponds to the value state.
*/
useEffect(() => {
flatListRef.current?.scrollToOffset({
offset: selectedIndex * itemHeight,
flatListRef.current?.scrollToIndex({
index: selectedIndex,
animated: Platform.OS === 'ios',
});
}, [selectedIndex, itemHeight]);

Expand Down

0 comments on commit b9569cc

Please sign in to comment.