@mpxjs/webpack-plugin 2.9.67 → 2.9.69-beta.0
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/index.js +13 -8
- package/lib/platform/json/wx/index.js +21 -8
- package/lib/platform/style/wx/index.js +35 -38
- package/lib/platform/template/wx/component-config/canvas.js +8 -0
- package/lib/platform/template/wx/component-config/fix-component-name.js +15 -12
- package/lib/platform/template/wx/component-config/index.js +1 -1
- package/lib/platform/template/wx/component-config/input.js +1 -1
- package/lib/platform/template/wx/component-config/rich-text.js +8 -0
- package/lib/platform/template/wx/component-config/swiper.js +1 -1
- package/lib/platform/template/wx/component-config/textarea.js +1 -1
- package/lib/platform/template/wx/component-config/unsupported.js +1 -1
- package/lib/react/processStyles.js +14 -4
- package/lib/react/processTemplate.js +3 -0
- package/lib/resolver/AddModePlugin.js +8 -8
- package/lib/runtime/components/react/context.ts +6 -0
- package/lib/runtime/components/react/dist/context.js +2 -0
- package/lib/runtime/components/react/dist/event.config.js +24 -24
- package/lib/runtime/components/react/dist/getInnerListeners.js +183 -174
- package/lib/runtime/components/react/dist/mpx-button.jsx +77 -49
- package/lib/runtime/components/react/dist/mpx-canvas/Bus.js +60 -0
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.js +15 -0
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.js +84 -0
- package/lib/runtime/components/react/dist/mpx-canvas/Image.js +87 -0
- package/lib/runtime/components/react/dist/mpx-canvas/ImageData.js +15 -0
- package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.js +28 -0
- package/lib/runtime/components/react/dist/mpx-canvas/html.js +343 -0
- package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +232 -0
- package/lib/runtime/components/react/dist/mpx-canvas/utils.jsx +89 -0
- package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +13 -19
- package/lib/runtime/components/react/dist/mpx-checkbox.jsx +29 -38
- package/lib/runtime/components/react/dist/mpx-form.jsx +16 -19
- package/lib/runtime/components/react/dist/mpx-icon.jsx +8 -16
- package/lib/runtime/components/react/dist/mpx-image.jsx +291 -0
- package/lib/runtime/components/react/dist/mpx-input.jsx +54 -27
- package/lib/runtime/components/react/dist/mpx-label.jsx +15 -22
- package/lib/runtime/components/react/dist/mpx-movable-area.jsx +13 -16
- package/lib/runtime/components/react/dist/mpx-movable-view.jsx +13 -13
- package/lib/runtime/components/react/dist/mpx-navigator.jsx +2 -4
- package/lib/runtime/components/react/dist/mpx-picker/date.jsx +6 -2
- package/lib/runtime/components/react/dist/mpx-picker/index.jsx +5 -3
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.jsx +6 -2
- package/lib/runtime/components/react/dist/mpx-picker/region.jsx +6 -2
- package/lib/runtime/components/react/dist/mpx-picker/selector.jsx +6 -2
- package/lib/runtime/components/react/dist/mpx-picker/time.jsx +10 -15
- package/lib/runtime/components/react/dist/mpx-picker-view-column-item.jsx +39 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +160 -88
- package/lib/runtime/components/react/dist/mpx-picker-view.jsx +80 -121
- package/lib/runtime/components/react/dist/mpx-radio-group.jsx +11 -19
- package/lib/runtime/components/react/dist/mpx-radio.jsx +27 -42
- package/lib/runtime/components/react/dist/mpx-rich-text/html.js +39 -0
- package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +63 -0
- package/lib/runtime/components/react/dist/mpx-root-portal.jsx +6 -4
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +47 -41
- package/lib/runtime/components/react/dist/mpx-simple-text.jsx +11 -0
- package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +4 -2
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +606 -0
- package/lib/runtime/components/react/dist/mpx-switch.jsx +20 -10
- package/lib/runtime/components/react/dist/mpx-text.jsx +11 -10
- package/lib/runtime/components/react/dist/mpx-textarea.jsx +8 -3
- package/lib/runtime/components/react/dist/mpx-view.jsx +65 -61
- package/lib/runtime/components/react/dist/mpx-web-view.jsx +112 -35
- package/lib/runtime/components/react/dist/pickerFaces.js +81 -0
- package/lib/runtime/components/react/dist/pickerVIewContext.js +9 -0
- package/lib/runtime/components/react/dist/pickerViewMask.jsx +18 -0
- package/lib/runtime/components/react/dist/pickerViewOverlay.jsx +23 -0
- package/lib/runtime/components/react/dist/useAnimationHooks.js +35 -9
- package/lib/runtime/components/react/dist/utils.jsx +70 -23
- package/lib/runtime/components/react/event.config.ts +25 -26
- package/lib/runtime/components/react/getInnerListeners.ts +237 -199
- package/lib/runtime/components/react/mpx-button.tsx +104 -57
- package/lib/runtime/components/react/mpx-canvas/Bus.ts +70 -0
- package/lib/runtime/components/react/mpx-canvas/CanvasGradient.ts +18 -0
- package/lib/runtime/components/react/mpx-canvas/CanvasRenderingContext2D.ts +87 -0
- package/lib/runtime/components/react/mpx-canvas/Image.ts +102 -0
- package/lib/runtime/components/react/mpx-canvas/ImageData.ts +23 -0
- package/lib/runtime/components/react/mpx-canvas/constructorsRegistry.ts +38 -0
- package/lib/runtime/components/react/mpx-canvas/html.ts +343 -0
- package/lib/runtime/components/react/mpx-canvas/index.tsx +296 -0
- package/lib/runtime/components/react/mpx-canvas/utils.tsx +150 -0
- package/lib/runtime/components/react/mpx-checkbox-group.tsx +28 -25
- package/lib/runtime/components/react/mpx-checkbox.tsx +48 -49
- package/lib/runtime/components/react/mpx-form.tsx +25 -28
- package/lib/runtime/components/react/mpx-icon.tsx +12 -17
- package/lib/runtime/components/react/mpx-image.tsx +436 -0
- package/lib/runtime/components/react/mpx-input.tsx +77 -57
- package/lib/runtime/components/react/mpx-label.tsx +26 -27
- package/lib/runtime/components/react/mpx-movable-area.tsx +18 -23
- package/lib/runtime/components/react/mpx-movable-view.tsx +21 -25
- package/lib/runtime/components/react/mpx-navigator.tsx +2 -8
- package/lib/runtime/components/react/mpx-picker/date.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker/index.tsx +3 -2
- package/lib/runtime/components/react/mpx-picker/multiSelector.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker/region.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker/selector.tsx +5 -2
- package/lib/runtime/components/react/mpx-picker/time.tsx +10 -15
- package/lib/runtime/components/react/mpx-picker/type.ts +48 -43
- package/lib/runtime/components/react/mpx-picker-view-column.tsx +236 -104
- package/lib/runtime/components/react/mpx-picker-view.tsx +132 -122
- package/lib/runtime/components/react/mpx-radio-group.tsx +24 -27
- package/lib/runtime/components/react/mpx-radio.tsx +45 -54
- package/lib/runtime/components/react/mpx-rich-text/html.ts +40 -0
- package/lib/runtime/components/react/mpx-rich-text/index.tsx +121 -0
- package/lib/runtime/components/react/mpx-root-portal.tsx +3 -5
- package/lib/runtime/components/react/mpx-scroll-view.tsx +72 -71
- package/lib/runtime/components/react/mpx-simple-text.tsx +18 -0
- package/lib/runtime/components/react/mpx-swiper/carouse.tsx +4 -2
- package/lib/runtime/components/react/mpx-swiper-item.tsx +3 -2
- package/lib/runtime/components/react/mpx-switch.tsx +29 -23
- package/lib/runtime/components/react/mpx-text.tsx +14 -18
- package/lib/runtime/components/react/mpx-textarea.tsx +11 -10
- package/lib/runtime/components/react/mpx-view.tsx +92 -76
- package/lib/runtime/components/react/mpx-web-view.tsx +116 -54
- package/lib/runtime/components/react/pickerFaces.ts +104 -0
- package/lib/runtime/components/react/pickerOverlay.tsx +32 -0
- package/lib/runtime/components/react/types/common.ts +2 -0
- package/lib/runtime/components/react/types/global.d.ts +5 -17
- package/lib/runtime/components/react/useAnimationHooks.ts +36 -11
- package/lib/runtime/components/react/utils.tsx +99 -28
- package/lib/runtime/components/web/getInnerListeners.js +6 -6
- package/lib/runtime/components/web/mpx-movable-view.vue +334 -344
- package/lib/runtime/components/web/mpx-picker-view-column.vue +75 -75
- package/lib/runtime/components/web/mpx-picker.vue +382 -385
- package/lib/runtime/components/web/mpx-web-view.vue +175 -161
- package/lib/runtime/optionProcessor.js +7 -38
- package/lib/runtime/utils.js +2 -0
- package/lib/style-compiler/plugins/scope-id.js +30 -2
- package/lib/template-compiler/bind-this.js +7 -2
- package/lib/template-compiler/compiler.js +79 -47
- package/lib/template-compiler/gen-node-react.js +3 -3
- package/lib/utils/pre-process-json.js +9 -5
- package/package.json +6 -4
- package/LICENSE +0 -433
- package/lib/runtime/components/react/dist/mpx-image/index.jsx +0 -226
- package/lib/runtime/components/react/dist/mpx-image/svg.jsx +0 -7
- package/lib/runtime/components/react/dist/mpx-swiper/carouse.jsx +0 -478
- 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/mpx-image/index.tsx +0 -345
- package/lib/runtime/components/react/mpx-image/svg.tsx +0 -22
- package/lib/runtime/components/web/event.js +0 -105
|
@@ -1,31 +1,51 @@
|
|
|
1
1
|
|
|
2
2
|
import { View, Animated, SafeAreaView, NativeScrollEvent, NativeSyntheticEvent, LayoutChangeEvent, ScrollView } from 'react-native'
|
|
3
|
-
import React, { forwardRef, useRef, useState,
|
|
4
|
-
import { useTransformStyle, splitStyle, splitProps, wrapChildren, useLayout } from './utils'
|
|
5
|
-
import useNodesRef, { HandlerRef } from './useNodesRef'
|
|
3
|
+
import React, { forwardRef, useRef, useState, useMemo, useCallback, useEffect } from 'react'
|
|
4
|
+
import { useTransformStyle, splitStyle, splitProps, wrapChildren, useLayout, usePrevious } from './utils'
|
|
5
|
+
import useNodesRef, { HandlerRef } from './useNodesRef'
|
|
6
|
+
import { createFaces } from './pickerFaces'
|
|
7
|
+
import PickerOverlay from './pickerOverlay'
|
|
8
|
+
|
|
6
9
|
interface ColumnProps {
|
|
7
|
-
children
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
children?: React.ReactNode
|
|
11
|
+
columnData: React.ReactNode[]
|
|
12
|
+
initialIndex: number
|
|
13
|
+
onColumnItemRawHChange: Function
|
|
14
|
+
getInnerLayout: Function
|
|
15
|
+
onSelectChange: Function
|
|
12
16
|
style: {
|
|
13
17
|
[key: string]: any
|
|
14
|
-
}
|
|
18
|
+
}
|
|
15
19
|
'enable-var': boolean
|
|
16
20
|
'external-var-context'?: Record<string, any>
|
|
17
21
|
wrapperStyle: {
|
|
18
|
-
height
|
|
19
|
-
itemHeight:
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
+
height: number
|
|
23
|
+
itemHeight: number
|
|
24
|
+
}
|
|
25
|
+
pickerOverlayStyle: Record<string, any>
|
|
26
|
+
columnIndex: number
|
|
22
27
|
}
|
|
23
|
-
|
|
24
|
-
//
|
|
25
|
-
|
|
28
|
+
|
|
29
|
+
// 默认的单个选项高度
|
|
30
|
+
const DefaultPickerItemH = 36
|
|
31
|
+
// 默认一屏可见选项个数
|
|
32
|
+
const visibleCount = 5
|
|
33
|
+
|
|
26
34
|
const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>, ColumnProps>((props: ColumnProps, ref) => {
|
|
27
|
-
const {
|
|
28
|
-
|
|
35
|
+
const {
|
|
36
|
+
columnData,
|
|
37
|
+
columnIndex,
|
|
38
|
+
initialIndex,
|
|
39
|
+
onSelectChange,
|
|
40
|
+
onColumnItemRawHChange,
|
|
41
|
+
getInnerLayout,
|
|
42
|
+
style,
|
|
43
|
+
wrapperStyle,
|
|
44
|
+
pickerOverlayStyle,
|
|
45
|
+
'enable-var': enableVar,
|
|
46
|
+
'external-var-context': externalVarContext
|
|
47
|
+
} = props
|
|
48
|
+
|
|
29
49
|
const {
|
|
30
50
|
normalStyle,
|
|
31
51
|
hasVarDec,
|
|
@@ -36,122 +56,234 @@ const _PickerViewColumn = forwardRef<HandlerRef<ScrollView & View, ColumnProps>,
|
|
|
36
56
|
} = useTransformStyle(style, { enableVar, externalVarContext })
|
|
37
57
|
const { textStyle } = splitStyle(normalStyle)
|
|
38
58
|
const { textProps } = splitProps(props)
|
|
39
|
-
// const { innerStyle } = splitStyle(normalStyle)
|
|
40
|
-
// scrollView的ref
|
|
41
59
|
const scrollViewRef = useRef<ScrollView>(null)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
60
|
+
|
|
61
|
+
useNodesRef(props, ref, scrollViewRef, {
|
|
62
|
+
style: normalStyle
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
const { height: pickerH, itemHeight = DefaultPickerItemH } = wrapperStyle
|
|
66
|
+
const [itemRawH, setItemRawH] = useState(0) // 单个选项真实渲染高度
|
|
67
|
+
const maxIndex = useMemo(() => columnData.length - 1, [columnData])
|
|
68
|
+
const touching = useRef(false)
|
|
69
|
+
const scrolling = useRef(false)
|
|
70
|
+
const activeIndex = useRef(initialIndex)
|
|
71
|
+
const prevIndex = usePrevious(initialIndex)
|
|
72
|
+
const prevMaxIndex = usePrevious(maxIndex)
|
|
73
|
+
|
|
74
|
+
const initialOffset = useMemo(() => ({
|
|
75
|
+
x: 0,
|
|
76
|
+
y: itemRawH * initialIndex
|
|
77
|
+
}), [itemRawH])
|
|
78
|
+
|
|
79
|
+
const snapToOffsets = useMemo(
|
|
80
|
+
() => columnData.map((_, i) => i * itemRawH),
|
|
81
|
+
[columnData, itemRawH]
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
const contentContainerStyle = useMemo(() => {
|
|
85
|
+
return [
|
|
86
|
+
{
|
|
87
|
+
paddingVertical: Math.round(pickerH - itemRawH) / 2
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}, [pickerH, itemRawH])
|
|
45
91
|
|
|
46
92
|
useEffect(() => {
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
93
|
+
if (
|
|
94
|
+
!scrollViewRef.current ||
|
|
95
|
+
!itemRawH ||
|
|
96
|
+
touching.current ||
|
|
97
|
+
scrolling.current ||
|
|
98
|
+
prevIndex == null ||
|
|
99
|
+
initialIndex === prevIndex ||
|
|
100
|
+
initialIndex === activeIndex.current ||
|
|
101
|
+
maxIndex !== prevMaxIndex
|
|
102
|
+
) {
|
|
103
|
+
return
|
|
50
104
|
}
|
|
51
|
-
|
|
105
|
+
|
|
106
|
+
activeIndex.current = initialIndex
|
|
107
|
+
scrollViewRef.current.scrollTo({
|
|
108
|
+
x: 0,
|
|
109
|
+
y: itemRawH * initialIndex,
|
|
110
|
+
animated: false
|
|
111
|
+
})
|
|
112
|
+
}, [itemRawH, initialIndex])
|
|
52
113
|
|
|
53
114
|
const onScrollViewLayout = () => {
|
|
54
115
|
getInnerLayout && getInnerLayout(layoutRef)
|
|
55
116
|
}
|
|
56
117
|
|
|
57
118
|
const {
|
|
58
|
-
// 存储layout布局信息
|
|
59
119
|
layoutRef,
|
|
60
120
|
layoutProps
|
|
61
|
-
} = useLayout({
|
|
121
|
+
} = useLayout({
|
|
122
|
+
props,
|
|
123
|
+
hasSelfPercent,
|
|
124
|
+
setWidth,
|
|
125
|
+
setHeight,
|
|
126
|
+
nodeRef: scrollViewRef,
|
|
127
|
+
onLayout: onScrollViewLayout
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
const onContentSizeChange = (w: number, h: number) => {
|
|
131
|
+
scrollViewRef.current?.scrollTo({
|
|
132
|
+
x: 0,
|
|
133
|
+
y: itemRawH * initialIndex,
|
|
134
|
+
animated: false
|
|
135
|
+
})
|
|
136
|
+
}
|
|
62
137
|
|
|
63
138
|
const onItemLayout = (e: LayoutChangeEvent) => {
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
onColumnLayoutChange && onColumnLayoutChange({ height: layout.height * 5 })
|
|
139
|
+
const { height: rawH } = e.nativeEvent.layout
|
|
140
|
+
if (rawH && itemRawH !== rawH) {
|
|
141
|
+
setItemRawH(rawH)
|
|
142
|
+
onColumnItemRawHChange(rawH)
|
|
69
143
|
}
|
|
70
144
|
}
|
|
71
145
|
|
|
146
|
+
const onTouchStart = () => {
|
|
147
|
+
touching.current = true
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const onTouchEnd = () => {
|
|
151
|
+
touching.current = false
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const onTouchCancel = () => {
|
|
155
|
+
touching.current = false
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const onMomentumScrollBegin = () => {
|
|
159
|
+
scrolling.current = true
|
|
160
|
+
}
|
|
161
|
+
|
|
72
162
|
const onMomentumScrollEnd = (e: NativeSyntheticEvent<NativeScrollEvent>) => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
163
|
+
scrolling.current = false
|
|
164
|
+
if (!itemRawH) {
|
|
165
|
+
return
|
|
166
|
+
}
|
|
167
|
+
const { y: scrollY } = e.nativeEvent.contentOffset
|
|
168
|
+
let calcIndex = Math.round(scrollY / itemRawH)
|
|
169
|
+
activeIndex.current = calcIndex
|
|
170
|
+
if (calcIndex !== initialIndex) {
|
|
171
|
+
calcIndex = Math.max(0, Math.min(calcIndex, maxIndex)) || 0
|
|
172
|
+
onSelectChange(calcIndex)
|
|
77
173
|
}
|
|
78
174
|
}
|
|
79
175
|
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
176
|
+
const offsetY = useRef(new Animated.Value(0)).current
|
|
177
|
+
|
|
178
|
+
const onScroll = useMemo(
|
|
179
|
+
() =>
|
|
180
|
+
Animated.event([{ nativeEvent: { contentOffset: { y: offsetY } } }], {
|
|
181
|
+
useNativeDriver: true
|
|
182
|
+
}),
|
|
183
|
+
[offsetY]
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
const faces = useMemo(() => createFaces(itemRawH, visibleCount), [itemRawH])
|
|
187
|
+
|
|
188
|
+
const getTransform = useCallback(
|
|
189
|
+
(index: number) => {
|
|
190
|
+
const inputRange = faces.map((f) => itemRawH * (index + f.index))
|
|
191
|
+
return {
|
|
192
|
+
opacity: offsetY.interpolate({
|
|
193
|
+
inputRange: inputRange,
|
|
194
|
+
outputRange: faces.map((x) => x.opacity),
|
|
195
|
+
extrapolate: 'clamp'
|
|
196
|
+
}),
|
|
197
|
+
rotateX: offsetY.interpolate({
|
|
198
|
+
inputRange: inputRange,
|
|
199
|
+
outputRange: faces.map((x) => `${x.deg}deg`),
|
|
200
|
+
extrapolate: 'extend'
|
|
201
|
+
}),
|
|
202
|
+
translateY: offsetY.interpolate({
|
|
203
|
+
inputRange: inputRange,
|
|
204
|
+
outputRange: faces.map((x) => x.offsetY),
|
|
205
|
+
extrapolate: 'extend'
|
|
206
|
+
})
|
|
93
207
|
}
|
|
94
|
-
|
|
95
|
-
|
|
208
|
+
},
|
|
209
|
+
[offsetY, faces, itemRawH]
|
|
210
|
+
)
|
|
96
211
|
|
|
97
|
-
|
|
98
|
-
|
|
212
|
+
const renderInnerchild = () =>
|
|
213
|
+
columnData.map((item: React.ReactNode, index: number) => {
|
|
99
214
|
const InnerProps = index === 0 ? { onLayout: onItemLayout } : {}
|
|
100
|
-
const strKey =
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
{
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
215
|
+
const strKey = `picker-column-${columnIndex}-${index}`
|
|
216
|
+
const { opacity, rotateX, translateY } = getTransform(index)
|
|
217
|
+
return (
|
|
218
|
+
<Animated.View
|
|
219
|
+
key={strKey}
|
|
220
|
+
{...InnerProps}
|
|
221
|
+
style={[
|
|
222
|
+
{
|
|
223
|
+
height: itemHeight || DefaultPickerItemH,
|
|
224
|
+
width: '100%',
|
|
225
|
+
opacity,
|
|
226
|
+
transform: [
|
|
227
|
+
{ translateY },
|
|
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>
|
|
244
|
+
)
|
|
116
245
|
})
|
|
117
|
-
const totalHeight = itemH * 5
|
|
118
|
-
if (wrapperStyle.height && totalHeight !== wrapperStyle.height) {
|
|
119
|
-
const fix = Math.ceil((totalHeight - wrapperStyle.height) / 2)
|
|
120
|
-
arrChild.unshift(<View key="picker-column-0" style={[{ height: itemH - fix }]}></View>)
|
|
121
|
-
arrChild.unshift(<View key="picker-column-1" style={[{ height: itemH }]}></View>)
|
|
122
|
-
arrChild.push(<View key="picker-column-2" style={[{ height: itemH }]}></View>)
|
|
123
|
-
arrChild.push(<View key="picker-column-3" style={[{ height: itemH - fix }]}></View>)
|
|
124
|
-
} else {
|
|
125
|
-
arrChild.unshift(<View key="picker-column-0" style={[{ height: itemH }]}></View>)
|
|
126
|
-
arrChild.unshift(<View key="picker-column-1" style={[{ height: itemH }]}></View>)
|
|
127
|
-
arrChild.push(<View key="picker-column-2" style={[{ height: itemH }]}></View>)
|
|
128
|
-
arrChild.push(<View key="picker-column-3" style={[{ height: itemH }]}></View>)
|
|
129
|
-
}
|
|
130
|
-
return arrChild
|
|
131
|
-
}
|
|
132
246
|
|
|
133
247
|
const renderScollView = () => {
|
|
134
|
-
return (
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
248
|
+
return (
|
|
249
|
+
<Animated.ScrollView
|
|
250
|
+
ref={scrollViewRef}
|
|
251
|
+
bounces={true}
|
|
252
|
+
horizontal={false}
|
|
253
|
+
pagingEnabled={false}
|
|
254
|
+
nestedScrollEnabled={true}
|
|
255
|
+
removeClippedSubviews={true}
|
|
256
|
+
showsVerticalScrollIndicator={false}
|
|
257
|
+
showsHorizontalScrollIndicator={false}
|
|
258
|
+
{...layoutProps}
|
|
259
|
+
scrollEventThrottle={16}
|
|
260
|
+
contentContainerStyle={contentContainerStyle}
|
|
261
|
+
contentOffset={initialOffset}
|
|
262
|
+
snapToOffsets={snapToOffsets}
|
|
263
|
+
onContentSizeChange={onContentSizeChange}
|
|
264
|
+
onScroll={onScroll}
|
|
265
|
+
onTouchStart={onTouchStart}
|
|
266
|
+
onTouchEnd={onTouchEnd}
|
|
267
|
+
onTouchCancel={onTouchCancel}
|
|
268
|
+
onMomentumScrollBegin={onMomentumScrollBegin}
|
|
269
|
+
onMomentumScrollEnd={onMomentumScrollEnd}
|
|
270
|
+
>
|
|
147
271
|
{renderInnerchild()}
|
|
148
|
-
|
|
272
|
+
</Animated.ScrollView>
|
|
273
|
+
)
|
|
149
274
|
}
|
|
150
275
|
|
|
151
|
-
|
|
152
|
-
{
|
|
153
|
-
|
|
276
|
+
const renderOverlay = () => (
|
|
277
|
+
<PickerOverlay itemHeight={itemHeight} overlayItemStyle={pickerOverlayStyle} />
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
return (
|
|
281
|
+
<SafeAreaView style={[{ display: 'flex', flex: 1 }]}>
|
|
282
|
+
{renderScollView()}
|
|
283
|
+
{renderOverlay()}
|
|
284
|
+
</SafeAreaView>
|
|
285
|
+
)
|
|
154
286
|
})
|
|
155
287
|
|
|
156
|
-
_PickerViewColumn.displayName = '
|
|
288
|
+
_PickerViewColumn.displayName = 'MpxPickerViewColumn'
|
|
157
289
|
export default _PickerViewColumn
|