@mpxjs/webpack-plugin 2.9.70 → 2.9.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/platform/template/wx/component-config/movable-view.js +8 -1
- package/lib/platform/template/wx/component-config/picker-view.js +1 -5
- package/lib/platform/template/wx/component-config/scroll-view.js +1 -1
- package/lib/platform/template/wx/index.js +0 -4
- package/lib/runtime/components/react/context.ts +8 -0
- package/lib/runtime/components/react/dist/context.js +2 -0
- package/lib/runtime/components/react/dist/getInnerListeners.js +34 -31
- package/lib/runtime/components/react/dist/mpx-button.jsx +16 -44
- package/lib/runtime/components/react/dist/mpx-movable-view.jsx +93 -58
- package/lib/runtime/components/react/dist/mpx-navigator.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-picker-view-column-item.jsx +35 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +151 -127
- package/lib/runtime/components/react/dist/mpx-picker-view.jsx +38 -34
- package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +10 -11
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +11 -4
- package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +31 -8
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +670 -0
- package/lib/runtime/components/react/dist/mpx-view.jsx +15 -53
- package/lib/runtime/components/react/dist/pickerFaces.js +7 -6
- package/lib/runtime/components/react/dist/pickerVIewContext.js +14 -0
- package/lib/runtime/components/react/dist/pickerViewIndicator.jsx +23 -0
- package/lib/runtime/components/react/dist/pickerViewMask.jsx +18 -0
- package/lib/runtime/components/react/dist/useAnimationHooks.js +20 -2
- package/lib/runtime/components/react/dist/utils.jsx +74 -11
- package/lib/runtime/components/react/getInnerListeners.ts +43 -32
- package/lib/runtime/components/react/mpx-button.tsx +20 -57
- package/lib/runtime/components/react/mpx-movable-view.tsx +119 -74
- package/lib/runtime/components/react/mpx-navigator.tsx +1 -1
- package/lib/runtime/components/react/mpx-picker-view-column-item.tsx +76 -0
- package/lib/runtime/components/react/mpx-picker-view-column.tsx +206 -183
- package/lib/runtime/components/react/mpx-picker-view.tsx +49 -48
- package/lib/runtime/components/react/mpx-rich-text/index.tsx +12 -18
- package/lib/runtime/components/react/mpx-scroll-view.tsx +21 -10
- package/lib/runtime/components/react/mpx-swiper-item.tsx +45 -11
- package/lib/runtime/components/react/mpx-swiper.tsx +742 -0
- package/lib/runtime/components/react/mpx-view.tsx +18 -65
- package/lib/runtime/components/react/pickerFaces.ts +10 -7
- package/lib/runtime/components/react/pickerVIewContext.ts +27 -0
- package/lib/runtime/components/react/pickerViewIndicator.tsx +34 -0
- package/lib/runtime/components/react/pickerViewMask.tsx +30 -0
- package/lib/runtime/components/react/types/{getInnerListeners.ts → getInnerListeners.d.ts} +4 -5
- package/lib/runtime/components/react/types/global.d.ts +10 -0
- package/lib/runtime/components/react/useAnimationHooks.ts +24 -3
- package/lib/runtime/components/react/utils.tsx +85 -12
- package/lib/runtime/components/web/mpx-checkbox.vue +1 -1
- package/lib/runtime/components/web/mpx-picker-view-column.vue +9 -4
- package/lib/template-compiler/compiler.js +61 -13
- package/lib/wxss/loader.js +15 -2
- package/package.json +3 -3
- package/lib/runtime/components/react/dist/mpx-swiper/carouse.jsx +0 -480
- package/lib/runtime/components/react/dist/mpx-swiper/index.jsx +0 -68
- package/lib/runtime/components/react/dist/mpx-swiper/type.js +0 -1
- package/lib/runtime/components/react/dist/pickerOverlay.jsx +0 -21
- package/lib/runtime/components/react/dist/types/common.js +0 -1
- package/lib/runtime/components/react/dist/types/getInnerListeners.js +0 -1
- package/lib/runtime/components/react/mpx-swiper/carouse.tsx +0 -527
- package/lib/runtime/components/react/mpx-swiper/index.tsx +0 -80
- package/lib/runtime/components/react/mpx-swiper/type.ts +0 -87
- package/lib/runtime/components/react/pickerOverlay.tsx +0 -32
- /package/lib/runtime/components/react/types/{common.ts → common.d.ts} +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { useTransformStyle, splitStyle, splitProps,
|
|
1
|
+
import React, { forwardRef, useRef, useState, useMemo, useEffect, useCallback } from 'react'
|
|
2
|
+
import { LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent, ScrollView, StyleSheet, View } from 'react-native'
|
|
3
|
+
import Reanimated, { AnimatedRef, useAnimatedRef, useScrollViewOffset } from 'react-native-reanimated'
|
|
4
|
+
import { useTransformStyle, splitStyle, splitProps, useLayout, usePrevious, isAndroid, isIOS } from './utils'
|
|
5
5
|
import useNodesRef, { HandlerRef } from './useNodesRef'
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import PickerIndicator from './pickerViewIndicator'
|
|
7
|
+
import PickerMask from './pickerViewMask'
|
|
8
|
+
import MpxPickerVIewColumnItem from './mpx-picker-view-column-item'
|
|
9
|
+
import { PickerViewColumnAnimationContext } from './pickerVIewContext'
|
|
8
10
|
|
|
9
11
|
interface ColumnProps {
|
|
10
12
|
children?: React.ReactNode
|
|
11
13
|
columnData: React.ReactNode[]
|
|
12
14
|
initialIndex: number
|
|
13
|
-
onColumnItemRawHChange: Function
|
|
14
|
-
getInnerLayout: Function
|
|
15
15
|
onSelectChange: Function
|
|
16
16
|
style: {
|
|
17
17
|
[key: string]: any
|
|
@@ -22,13 +22,11 @@ interface ColumnProps {
|
|
|
22
22
|
height: number
|
|
23
23
|
itemHeight: number
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
pickerMaskStyle: Record<string, any>
|
|
26
|
+
pickerIndicatorStyle: Record<string, any>
|
|
26
27
|
columnIndex: number
|
|
27
28
|
}
|
|
28
29
|
|
|
29
|
-
// 默认的单个选项高度
|
|
30
|
-
const DefaultPickerItemH = 36
|
|
31
|
-
// 默认一屏可见选项个数
|
|
32
30
|
const visibleCount = 5
|
|
33
31
|
|
|
34
32
|
const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>, ColumnProps>((props: ColumnProps, ref) => {
|
|
@@ -37,57 +35,90 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
|
|
|
37
35
|
columnIndex,
|
|
38
36
|
initialIndex,
|
|
39
37
|
onSelectChange,
|
|
40
|
-
onColumnItemRawHChange,
|
|
41
|
-
getInnerLayout,
|
|
42
38
|
style,
|
|
43
39
|
wrapperStyle,
|
|
44
|
-
|
|
40
|
+
pickerMaskStyle,
|
|
41
|
+
pickerIndicatorStyle,
|
|
45
42
|
'enable-var': enableVar,
|
|
46
43
|
'external-var-context': externalVarContext
|
|
47
44
|
} = props
|
|
48
45
|
|
|
49
46
|
const {
|
|
50
47
|
normalStyle,
|
|
51
|
-
hasVarDec,
|
|
52
|
-
varContextRef,
|
|
53
48
|
hasSelfPercent,
|
|
54
49
|
setWidth,
|
|
55
50
|
setHeight
|
|
56
51
|
} = useTransformStyle(style, { enableVar, externalVarContext })
|
|
57
|
-
const { textStyle } = splitStyle(normalStyle)
|
|
58
|
-
const { textProps } = splitProps(props)
|
|
59
|
-
const scrollViewRef =
|
|
52
|
+
const { textStyle = {} } = splitStyle(normalStyle)
|
|
53
|
+
const { textProps = {} } = splitProps(props)
|
|
54
|
+
const scrollViewRef = useAnimatedRef<Reanimated.ScrollView>()
|
|
55
|
+
const offsetYShared = useScrollViewOffset(scrollViewRef as AnimatedRef<Reanimated.ScrollView>)
|
|
60
56
|
|
|
61
|
-
useNodesRef(props, ref, scrollViewRef
|
|
57
|
+
useNodesRef(props, ref, scrollViewRef as AnimatedRef<ScrollView>, {
|
|
62
58
|
style: normalStyle
|
|
63
59
|
})
|
|
64
60
|
|
|
65
|
-
const { height: pickerH, itemHeight
|
|
66
|
-
const [itemRawH, setItemRawH] = useState(
|
|
61
|
+
const { height: pickerH, itemHeight } = wrapperStyle
|
|
62
|
+
const [itemRawH, setItemRawH] = useState(itemHeight)
|
|
67
63
|
const maxIndex = useMemo(() => columnData.length - 1, [columnData])
|
|
64
|
+
const prevScrollingInfo = useRef({ index: initialIndex, y: 0 })
|
|
68
65
|
const touching = useRef(false)
|
|
69
66
|
const scrolling = useRef(false)
|
|
67
|
+
const timerResetPosition = useRef<NodeJS.Timeout | null>(null)
|
|
68
|
+
const timerScrollTo = useRef<NodeJS.Timeout | null>(null)
|
|
70
69
|
const activeIndex = useRef(initialIndex)
|
|
71
70
|
const prevIndex = usePrevious(initialIndex)
|
|
72
71
|
const prevMaxIndex = usePrevious(maxIndex)
|
|
73
72
|
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
const {
|
|
74
|
+
layoutProps
|
|
75
|
+
} = useLayout({
|
|
76
|
+
props,
|
|
77
|
+
hasSelfPercent,
|
|
78
|
+
setWidth,
|
|
79
|
+
setHeight,
|
|
80
|
+
nodeRef: scrollViewRef
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
const paddingHeight = useMemo(
|
|
84
|
+
() => Math.round((pickerH - itemHeight) / 2),
|
|
85
|
+
[pickerH, itemHeight]
|
|
86
|
+
)
|
|
78
87
|
|
|
79
88
|
const snapToOffsets = useMemo(
|
|
80
|
-
() =>
|
|
81
|
-
[
|
|
89
|
+
() => Array.from({ length: maxIndex + 1 }, (_, i) => i * itemRawH),
|
|
90
|
+
[maxIndex, itemRawH]
|
|
82
91
|
)
|
|
83
92
|
|
|
84
93
|
const contentContainerStyle = useMemo(() => {
|
|
85
|
-
return [
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
94
|
+
return [{ paddingVertical: paddingHeight }]
|
|
95
|
+
}, [paddingHeight])
|
|
96
|
+
|
|
97
|
+
const getIndex = useCallback((y: number) => {
|
|
98
|
+
const calc = Math.round(y / itemRawH)
|
|
99
|
+
return Math.max(0, Math.min(calc, maxIndex))
|
|
100
|
+
}, [itemRawH, maxIndex])
|
|
101
|
+
|
|
102
|
+
const clearTimerResetPosition = useCallback(() => {
|
|
103
|
+
if (timerResetPosition.current) {
|
|
104
|
+
clearTimeout(timerResetPosition.current)
|
|
105
|
+
timerResetPosition.current = null
|
|
106
|
+
}
|
|
107
|
+
}, [])
|
|
108
|
+
|
|
109
|
+
const clearTimerScrollTo = useCallback(() => {
|
|
110
|
+
if (timerScrollTo.current) {
|
|
111
|
+
clearTimeout(timerScrollTo.current)
|
|
112
|
+
timerScrollTo.current = null
|
|
113
|
+
}
|
|
114
|
+
}, [])
|
|
115
|
+
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
return () => {
|
|
118
|
+
clearTimerResetPosition()
|
|
119
|
+
clearTimerScrollTo()
|
|
120
|
+
}
|
|
121
|
+
}, [])
|
|
91
122
|
|
|
92
123
|
useEffect(() => {
|
|
93
124
|
if (
|
|
@@ -102,188 +133,180 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
|
|
|
102
133
|
) {
|
|
103
134
|
return
|
|
104
135
|
}
|
|
105
|
-
|
|
136
|
+
clearTimerScrollTo()
|
|
137
|
+
timerScrollTo.current = setTimeout(() => {
|
|
138
|
+
scrollViewRef.current?.scrollTo({
|
|
139
|
+
x: 0,
|
|
140
|
+
y: initialIndex * itemRawH,
|
|
141
|
+
animated: false
|
|
142
|
+
})
|
|
143
|
+
}, isAndroid ? 200 : 0)
|
|
106
144
|
activeIndex.current = initialIndex
|
|
107
|
-
|
|
108
|
-
x: 0,
|
|
109
|
-
y: itemRawH * initialIndex,
|
|
110
|
-
animated: false
|
|
111
|
-
})
|
|
112
|
-
}, [itemRawH, initialIndex])
|
|
113
|
-
|
|
114
|
-
const onScrollViewLayout = () => {
|
|
115
|
-
getInnerLayout && getInnerLayout(layoutRef)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const {
|
|
119
|
-
layoutRef,
|
|
120
|
-
layoutProps
|
|
121
|
-
} = useLayout({
|
|
122
|
-
props,
|
|
123
|
-
hasSelfPercent,
|
|
124
|
-
setWidth,
|
|
125
|
-
setHeight,
|
|
126
|
-
nodeRef: scrollViewRef,
|
|
127
|
-
onLayout: onScrollViewLayout
|
|
128
|
-
})
|
|
145
|
+
}, [itemRawH, maxIndex, initialIndex])
|
|
129
146
|
|
|
130
|
-
const onContentSizeChange = (
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
147
|
+
const onContentSizeChange = useCallback((_w: number, h: number) => {
|
|
148
|
+
const y = initialIndex * itemRawH
|
|
149
|
+
if (y <= h) {
|
|
150
|
+
clearTimerScrollTo()
|
|
151
|
+
timerScrollTo.current = setTimeout(() => {
|
|
152
|
+
scrollViewRef.current?.scrollTo({ x: 0, y, animated: false })
|
|
153
|
+
}, 0)
|
|
154
|
+
}
|
|
155
|
+
}, [itemRawH, initialIndex])
|
|
137
156
|
|
|
138
|
-
const onItemLayout = (e: LayoutChangeEvent) => {
|
|
157
|
+
const onItemLayout = useCallback((e: LayoutChangeEvent) => {
|
|
139
158
|
const { height: rawH } = e.nativeEvent.layout
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
159
|
+
const roundedH = Math.round(rawH)
|
|
160
|
+
if (roundedH && roundedH !== itemRawH) {
|
|
161
|
+
setItemRawH(roundedH)
|
|
143
162
|
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const onTouchStart = () => {
|
|
147
|
-
touching.current = true
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const onTouchEnd = () => {
|
|
151
|
-
touching.current = false
|
|
152
|
-
}
|
|
163
|
+
}, [itemRawH])
|
|
153
164
|
|
|
154
|
-
const
|
|
155
|
-
touching.current
|
|
156
|
-
|
|
165
|
+
const resetScrollPosition = useCallback((y: number) => {
|
|
166
|
+
if (touching.current || scrolling.current) {
|
|
167
|
+
return
|
|
168
|
+
}
|
|
169
|
+
scrolling.current = true
|
|
170
|
+
const targetIndex = getIndex(y)
|
|
171
|
+
scrollViewRef.current?.scrollTo({ x: 0, y: targetIndex * itemRawH, animated: false })
|
|
172
|
+
}, [itemRawH, getIndex])
|
|
157
173
|
|
|
158
|
-
const onMomentumScrollBegin = () => {
|
|
174
|
+
const onMomentumScrollBegin = useCallback(() => {
|
|
175
|
+
isIOS && clearTimerResetPosition()
|
|
159
176
|
scrolling.current = true
|
|
160
|
-
}
|
|
177
|
+
}, [])
|
|
161
178
|
|
|
162
|
-
const onMomentumScrollEnd = (e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
179
|
+
const onMomentumScrollEnd = useCallback((e: NativeSyntheticEvent<NativeScrollEvent> | { nativeEvent: { contentOffset: { y: number } } }) => {
|
|
163
180
|
scrolling.current = false
|
|
164
|
-
if (!itemRawH) {
|
|
165
|
-
return
|
|
166
|
-
}
|
|
167
181
|
const { y: scrollY } = e.nativeEvent.contentOffset
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
182
|
+
if (isIOS && scrollY % itemRawH !== 0) {
|
|
183
|
+
return resetScrollPosition(scrollY)
|
|
184
|
+
}
|
|
185
|
+
const calcIndex = getIndex(scrollY)
|
|
186
|
+
if (calcIndex !== activeIndex.current) {
|
|
187
|
+
activeIndex.current = calcIndex
|
|
172
188
|
onSelectChange(calcIndex)
|
|
173
189
|
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const offsetY = useRef(new Animated.Value(0)).current
|
|
190
|
+
}, [itemRawH, getIndex, onSelectChange, resetScrollPosition])
|
|
177
191
|
|
|
178
|
-
const
|
|
179
|
-
()
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
192
|
+
const onScrollBeginDrag = useCallback(() => {
|
|
193
|
+
isIOS && clearTimerResetPosition()
|
|
194
|
+
touching.current = true
|
|
195
|
+
prevScrollingInfo.current = {
|
|
196
|
+
index: activeIndex.current,
|
|
197
|
+
y: activeIndex.current * itemRawH
|
|
198
|
+
}
|
|
199
|
+
}, [itemRawH])
|
|
185
200
|
|
|
186
|
-
const
|
|
201
|
+
const onScrollEndDrag = useCallback((e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
202
|
+
touching.current = false
|
|
203
|
+
if (isIOS) {
|
|
204
|
+
const { y } = e.nativeEvent.contentOffset
|
|
205
|
+
if (y % itemRawH === 0) {
|
|
206
|
+
onMomentumScrollEnd({ nativeEvent: { contentOffset: { y } } })
|
|
207
|
+
} else if (y > 0 && y < snapToOffsets[maxIndex]) {
|
|
208
|
+
timerResetPosition.current = setTimeout(() => {
|
|
209
|
+
resetScrollPosition(y)
|
|
210
|
+
}, 10)
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}, [itemRawH, maxIndex, snapToOffsets, onMomentumScrollEnd, resetScrollPosition])
|
|
187
214
|
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
215
|
+
const onScroll = useCallback((e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
216
|
+
// 全局注册的振动触感 hook
|
|
217
|
+
const pickerVibrate = global.__mpx?.config?.rnConfig?.pickerVibrate
|
|
218
|
+
if (typeof pickerVibrate !== 'function') {
|
|
219
|
+
return
|
|
220
|
+
}
|
|
221
|
+
const { y } = e.nativeEvent.contentOffset
|
|
222
|
+
const { index: prevIndex, y: _y } = prevScrollingInfo.current
|
|
223
|
+
if (touching.current || scrolling.current) {
|
|
224
|
+
if (Math.abs(y - _y) >= itemRawH) {
|
|
225
|
+
const currentId = getIndex(y)
|
|
226
|
+
if (currentId !== prevIndex) {
|
|
227
|
+
prevScrollingInfo.current = {
|
|
228
|
+
index: currentId,
|
|
229
|
+
y: currentId * itemRawH
|
|
230
|
+
}
|
|
231
|
+
// vibrateShort({ type: 'selection' })
|
|
232
|
+
pickerVibrate()
|
|
233
|
+
}
|
|
207
234
|
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
)
|
|
235
|
+
}
|
|
236
|
+
}, [itemRawH, getIndex])
|
|
211
237
|
|
|
212
238
|
const renderInnerchild = () =>
|
|
213
|
-
columnData.map((item: React.
|
|
214
|
-
const InnerProps = index === 0 ? { onLayout: onItemLayout } : {}
|
|
215
|
-
const strKey = `picker-column-${columnIndex}-${index}`
|
|
216
|
-
const { opacity, rotateX, translateY } = getTransform(index)
|
|
239
|
+
columnData.map((item: React.ReactElement, index: number) => {
|
|
217
240
|
return (
|
|
218
|
-
<
|
|
219
|
-
key={
|
|
220
|
-
{
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
{ rotateX },
|
|
229
|
-
{ perspective: 1000 } // 适配 Android
|
|
230
|
-
]
|
|
231
|
-
}
|
|
232
|
-
]}
|
|
233
|
-
>
|
|
234
|
-
{wrapChildren(
|
|
235
|
-
{ children: item },
|
|
236
|
-
{
|
|
237
|
-
hasVarDec,
|
|
238
|
-
varContext: varContextRef.current,
|
|
239
|
-
textStyle,
|
|
240
|
-
textProps
|
|
241
|
-
}
|
|
242
|
-
)}
|
|
243
|
-
</Animated.View>
|
|
241
|
+
<MpxPickerVIewColumnItem
|
|
242
|
+
key={index}
|
|
243
|
+
item={item}
|
|
244
|
+
index={index}
|
|
245
|
+
itemHeight={itemHeight}
|
|
246
|
+
textStyle={textStyle}
|
|
247
|
+
textProps={textProps}
|
|
248
|
+
visibleCount={visibleCount}
|
|
249
|
+
onItemLayout={onItemLayout}
|
|
250
|
+
/>
|
|
244
251
|
)
|
|
245
252
|
})
|
|
246
253
|
|
|
247
254
|
const renderScollView = () => {
|
|
248
255
|
return (
|
|
249
|
-
<
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
256
|
+
<PickerViewColumnAnimationContext.Provider value={offsetYShared}>
|
|
257
|
+
<Reanimated.ScrollView
|
|
258
|
+
ref={scrollViewRef}
|
|
259
|
+
bounces={true}
|
|
260
|
+
horizontal={false}
|
|
261
|
+
nestedScrollEnabled={true}
|
|
262
|
+
removeClippedSubviews={false}
|
|
263
|
+
showsVerticalScrollIndicator={false}
|
|
264
|
+
showsHorizontalScrollIndicator={false}
|
|
265
|
+
scrollEventThrottle={16}
|
|
266
|
+
{...layoutProps}
|
|
267
|
+
style={[{ width: '100%' }]}
|
|
268
|
+
decelerationRate="fast"
|
|
269
|
+
snapToOffsets={snapToOffsets}
|
|
270
|
+
onScroll={onScroll}
|
|
271
|
+
onScrollBeginDrag={onScrollBeginDrag}
|
|
272
|
+
onScrollEndDrag={onScrollEndDrag}
|
|
273
|
+
onMomentumScrollBegin={onMomentumScrollBegin}
|
|
274
|
+
onMomentumScrollEnd={onMomentumScrollEnd}
|
|
275
|
+
onContentSizeChange={onContentSizeChange}
|
|
276
|
+
contentContainerStyle={contentContainerStyle}
|
|
277
|
+
>
|
|
278
|
+
{renderInnerchild()}
|
|
279
|
+
</Reanimated.ScrollView>
|
|
280
|
+
</PickerViewColumnAnimationContext.Provider>
|
|
273
281
|
)
|
|
274
282
|
}
|
|
275
283
|
|
|
276
|
-
const
|
|
277
|
-
<
|
|
284
|
+
const renderIndicator = () => (
|
|
285
|
+
<PickerIndicator
|
|
286
|
+
itemHeight={itemHeight}
|
|
287
|
+
indicatorItemStyle={pickerIndicatorStyle}
|
|
288
|
+
/>
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
const renderMask = () => (
|
|
292
|
+
<PickerMask
|
|
293
|
+
itemHeight={itemHeight}
|
|
294
|
+
maskContainerStyle={pickerMaskStyle}
|
|
295
|
+
/>
|
|
278
296
|
)
|
|
279
297
|
|
|
280
298
|
return (
|
|
281
|
-
<
|
|
299
|
+
<View style={[styles.wrapper, normalStyle]}>
|
|
282
300
|
{renderScollView()}
|
|
283
|
-
{
|
|
284
|
-
|
|
301
|
+
{renderMask()}
|
|
302
|
+
{renderIndicator()}
|
|
303
|
+
</View>
|
|
285
304
|
)
|
|
286
305
|
})
|
|
287
306
|
|
|
307
|
+
const styles = StyleSheet.create({
|
|
308
|
+
wrapper: { display: 'flex', flex: 1 }
|
|
309
|
+
})
|
|
310
|
+
|
|
288
311
|
_PickerViewColumn.displayName = 'MpxPickerViewColumn'
|
|
289
312
|
export default _PickerViewColumn
|