@@ -98,6 +98,11 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
9898 return [ { paddingVertical : paddingHeight } ]
9999 } , [ paddingHeight ] )
100100
101+ const initialContentOffsetY = useMemo (
102+ ( ) => initialIndex * itemRawH ,
103+ [ initialIndex , itemRawH ]
104+ )
105+
101106 const getIndex = useCallback ( ( y : number ) => {
102107 const calc = Math . round ( y / itemRawH )
103108 return Math . max ( 0 , Math . min ( calc , maxIndex ) )
@@ -155,17 +160,6 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
155160 } , isIOS ? 0 : 200 )
156161 } , [ itemRawH , maxIndex , initialIndex ] )
157162
158- const onContentSizeChange = useCallback ( ( _w : number , h : number ) => {
159- const y = initialIndex * itemRawH
160- if ( y <= h ) {
161- clearTimerScrollTo ( )
162- timerScrollTo . current = setTimeout ( ( ) => {
163- scrollViewRef . current ?. scrollTo ( { x : 0 , y, animated : false } )
164- activeIndex . current = initialIndex
165- } , 0 )
166- }
167- } , [ itemRawH , initialIndex ] )
168-
169163 const onItemLayout = useCallback ( ( e : LayoutChangeEvent ) => {
170164 const { height : rawH } = e . nativeEvent . layout
171165 const roundedH = Math . round ( rawH )
@@ -331,8 +325,8 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
331325 onScrollEndDrag,
332326 onMomentumScrollBegin,
333327 onMomentumScrollEnd,
334- onContentSizeChange ,
335- contentContainerStyle
328+ contentContainerStyle ,
329+ contentOffset : { x : 0 , y : initialContentOffsetY }
336330 } ) as React . ComponentProps < typeof Reanimated . ScrollView >
337331
338332 return createElement (
0 commit comments