@@ -94,7 +94,11 @@ const Picker = (props: PickerProps) => {
94
94
} , [ containerStyle , textStyle ] ) ;
95
95
const location = ( scrollY : number , index : number ) => {
96
96
scrollView . current ?. scrollTo ( { x : 0 , y : scrollY - ( style . containerHeight as number ) , animated : true } ) ;
97
+ saveY . current = scrollY - ( style . containerHeight as number ) ;
97
98
currentY . current = index ;
99
+ if ( Platform . OS === 'android' ) {
100
+ setCurrent ( index ) ;
101
+ }
98
102
} ;
99
103
const scrollYEnd = ( event : NativeSyntheticEvent < NativeScrollEvent > ) => {
100
104
if ( onPressORonScroll . current === 'onScroll' ) {
@@ -117,6 +121,7 @@ const Picker = (props: PickerProps) => {
117
121
}
118
122
if ( saveY . current <= ItemHeights [ 0 ] / 1.1 ) {
119
123
scrollView . current ?. scrollTo ( { x : 0 , y : 0 , animated : true } ) ;
124
+ saveY . current = 0 ;
120
125
setCurrent ( 0 ) ;
121
126
return false ;
122
127
}
@@ -126,6 +131,7 @@ const Picker = (props: PickerProps) => {
126
131
const itemIndex = decimal >= 9 ? integer + 1 : integer ;
127
132
scrollView . current ?. scrollTo ( { x : 0 , y : ItemHeights [ itemIndex ] - ItemHeights [ 0 ] , animated : true } ) ;
128
133
setCurrent ( itemIndex ) ;
134
+ saveY . current = ItemHeights [ itemIndex ] - ItemHeights [ 0 ] ;
129
135
isScroll . current = false ;
130
136
isTouchEnd . current = false ;
131
137
} ;
@@ -148,6 +154,9 @@ const Picker = (props: PickerProps) => {
148
154
if ( onPressORonScroll . current === 'onPress' || flag ) {
149
155
return false ;
150
156
}
157
+ if ( saveY . current === event . nativeEvent . contentOffset . y ) {
158
+ return false ;
159
+ }
151
160
isScroll . current = false ;
152
161
saveY . current = event . nativeEvent . contentOffset . y ;
153
162
if ( timer . current ) {
0 commit comments