@@ -92,12 +92,11 @@ const Picker = (props: PickerProps) => {
92
92
containerHeight,
93
93
} ;
94
94
} , [ containerStyle , textStyle ] ) ;
95
- const getItemHeight = ( event : LayoutChangeEvent , index : number ) => {
95
+ const getItemHeight = ( event : LayoutChangeEvent ) => {
96
96
const { height } = event . nativeEvent . layout ;
97
97
const round = Math . round ( height ) ;
98
- ItemHeights [ index ] = round * ItemHeights . length + round ;
98
+ ItemHeights . push ( round * ItemHeights . length + round ) ;
99
99
} ;
100
-
101
100
const location = ( scrollY : number , index : number ) => {
102
101
saveY . current = scrollY - ( style . containerHeight as number ) ;
103
102
currentY . current = index ;
@@ -113,7 +112,7 @@ const Picker = (props: PickerProps) => {
113
112
setCurrent ( 0 ) ;
114
113
return false ;
115
114
}
116
- const stringSpot = spot + '' ;
115
+ const stringSpot = spot + '.0 ' ;
117
116
const integer = Math . floor ( spot ) ;
118
117
const decimal = Number ( stringSpot [ stringSpot . indexOf ( '.' ) + 1 ] ) ;
119
118
const itemIndex = decimal >= 6 ? integer + 1 : integer ;
@@ -158,7 +157,7 @@ const Picker = (props: PickerProps) => {
158
157
>
159
158
{ date . map ( ( item , index ) => (
160
159
< Pressable
161
- onLayout = { ( event : LayoutChangeEvent ) => getItemHeight ( event , index ) }
160
+ onLayout = { getItemHeight }
162
161
key = { index }
163
162
onPressOut = { Platform . OS === 'android' ? onTouchEnd : undefined }
164
163
onPress = { ( ) => {
0 commit comments