File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ Picker 选择器
33
44解决 ios 与 android 和用户交互方式不同问题.
55
6- > 避免出现样式错乱问题, 请尽量使用统一数字高度 。
6+ > 避免出现样式错乱问题, 请尽量使用统一整数数字高度 。
77> 激活状态尽量不要改变高度, 只是修改颜色作为标记。
88 <!--rehype:style=border-left: 8px solid #ffe564;background-color: #ffe56440;padding: 12px 16px;-->
99
Original file line number Diff line number Diff line change @@ -92,10 +92,10 @@ const Picker = (props: PickerProps) => {
9292 containerHeight,
9393 } ;
9494 } , [ containerStyle , textStyle ] ) ;
95- const getItemHeight = ( event : LayoutChangeEvent ) => {
95+ const getItemHeight = ( event : LayoutChangeEvent , index : number ) => {
9696 const { height } = event . nativeEvent . layout ;
9797 const round = Math . round ( height ) ;
98- ItemHeights ?. push ( round * ItemHeights . length + round ) ;
98+ ItemHeights [ index ] = round * ItemHeights . length + round ;
9999 } ;
100100
101101 const location = ( scrollY : number , index : number ) => {
@@ -158,7 +158,7 @@ const Picker = (props: PickerProps) => {
158158 >
159159 { date . map ( ( item , index ) => (
160160 < Pressable
161- onLayout = { getItemHeight }
161+ onLayout = { ( event : LayoutChangeEvent ) => getItemHeight ( event , index ) }
162162 key = { index }
163163 onPressOut = { Platform . OS === 'android' ? onTouchEnd : undefined }
164164 onPress = { ( ) => {
You can’t perform that action at this time.
0 commit comments