Skip to content

Commit b9569cc

Browse files
fix: time picker issue on android
1 parent 5754276 commit b9569cc

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-ui-datepicker",
3-
"version": "2.0.5",
3+
"version": "2.0.6",
44
"description": "Customizable date picker for React Native",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",

src/components/TimePicker/wheel-picker/wheel-picker.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
ViewProps,
1111
FlatListProps,
1212
FlatList,
13+
Platform,
1314
} from 'react-native';
1415
import styles from './wheel-picker.style';
1516
import WheelPickerItem from './wheel-picker-item';
@@ -109,8 +110,9 @@ const WheelPicker: React.FC<Props> = ({
109110
* This ensures that what the user sees as selected in the picker always corresponds to the value state.
110111
*/
111112
useEffect(() => {
112-
flatListRef.current?.scrollToOffset({
113-
offset: selectedIndex * itemHeight,
113+
flatListRef.current?.scrollToIndex({
114+
index: selectedIndex,
115+
animated: Platform.OS === 'ios',
114116
});
115117
}, [selectedIndex, itemHeight]);
116118

0 commit comments

Comments
 (0)