@mpxjs/webpack-plugin 2.9.40 → 2.9.41-react.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/config.js +63 -97
- package/lib/dependencies/{RecordVueContentDependency.js → RecordLoaderContentDependency.js} +5 -5
- package/lib/dependencies/ResolveDependency.js +2 -2
- package/lib/helpers.js +5 -1
- package/lib/index.js +26 -21
- package/lib/loader.js +43 -97
- package/lib/native-loader.js +0 -1
- package/lib/platform/index.js +3 -0
- package/lib/platform/style/wx/index.js +414 -0
- package/lib/platform/template/wx/component-config/button.js +36 -0
- package/lib/platform/template/wx/component-config/image.js +15 -0
- package/lib/platform/template/wx/component-config/input.js +41 -0
- package/lib/platform/template/wx/component-config/scroll-view.js +27 -1
- package/lib/platform/template/wx/component-config/swiper-item.js +13 -1
- package/lib/platform/template/wx/component-config/swiper.js +25 -1
- package/lib/platform/template/wx/component-config/text.js +15 -0
- package/lib/platform/template/wx/component-config/textarea.js +39 -0
- package/lib/platform/template/wx/component-config/unsupported.js +18 -0
- package/lib/platform/template/wx/component-config/view.js +14 -0
- package/lib/platform/template/wx/index.js +88 -4
- package/lib/react/index.js +104 -0
- package/lib/react/processJSON.js +361 -0
- package/lib/react/processMainScript.js +21 -0
- package/lib/react/processScript.js +70 -0
- package/lib/react/processStyles.js +69 -0
- package/lib/react/processTemplate.js +153 -0
- package/lib/react/script-helper.js +133 -0
- package/lib/react/style-helper.js +91 -0
- package/lib/resolver/PackageEntryPlugin.js +1 -0
- package/lib/runtime/components/react/event.config.ts +32 -0
- package/lib/runtime/components/react/getInnerListeners.ts +289 -0
- package/lib/runtime/components/react/getInnerListeners.type.ts +68 -0
- package/lib/runtime/components/react/mpx-button.tsx +402 -0
- package/lib/runtime/components/react/mpx-image/index.tsx +351 -0
- package/lib/runtime/components/react/mpx-image/svg.tsx +21 -0
- package/lib/runtime/components/react/mpx-input.tsx +389 -0
- package/lib/runtime/components/react/mpx-scroll-view.tsx +412 -0
- package/lib/runtime/components/react/mpx-swiper/carouse.tsx +398 -0
- package/lib/runtime/components/react/mpx-swiper/index.tsx +68 -0
- package/lib/runtime/components/react/mpx-swiper/type.ts +69 -0
- package/lib/runtime/components/react/mpx-swiper-item.tsx +42 -0
- package/lib/runtime/components/react/mpx-text.tsx +106 -0
- package/lib/runtime/components/react/mpx-textarea.tsx +46 -0
- package/lib/runtime/components/react/mpx-view.tsx +397 -0
- package/lib/runtime/components/react/useNodesRef.ts +39 -0
- package/lib/runtime/components/react/utils.ts +92 -0
- package/lib/runtime/optionProcessorReact.d.ts +9 -0
- package/lib/runtime/optionProcessorReact.js +21 -0
- package/lib/runtime/stringify.wxs +3 -8
- package/lib/style-compiler/index.js +2 -1
- package/lib/template-compiler/compiler.js +287 -36
- package/lib/template-compiler/gen-node-react.js +95 -0
- package/lib/template-compiler/index.js +15 -24
- package/lib/utils/env.js +17 -0
- package/lib/utils/make-map.js +1 -1
- package/lib/utils/shallow-stringify.js +12 -12
- package/lib/web/index.js +123 -0
- package/lib/web/processJSON.js +3 -3
- package/lib/web/processMainScript.js +25 -23
- package/lib/web/processScript.js +12 -16
- package/lib/web/processTemplate.js +13 -12
- package/lib/web/script-helper.js +14 -22
- package/package.json +4 -3
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ✔ scroll-x
|
|
3
|
+
* ✔ scroll-y
|
|
4
|
+
* ✔ upper-threshold
|
|
5
|
+
* ✔ lower-threshold
|
|
6
|
+
* ✔ scroll-top
|
|
7
|
+
* ✔ scroll-left
|
|
8
|
+
* ✘ scroll-into-view
|
|
9
|
+
* ✔ scroll-with-animation
|
|
10
|
+
* ✔ enable-back-to-top
|
|
11
|
+
* ✘ enable-passive
|
|
12
|
+
* ✔ refresher-enabled
|
|
13
|
+
* ✘ refresher-threshold
|
|
14
|
+
* ✔ refresher-default-style(仅 android 支持)
|
|
15
|
+
* ✔ refresher-background(仅 android 支持)
|
|
16
|
+
* ✔ refresher-triggered
|
|
17
|
+
* ✘ enable-flex(scroll-x,rn 默认支持)
|
|
18
|
+
* ✘ scroll-anchoring
|
|
19
|
+
* ✔ paging-enabled
|
|
20
|
+
* ✘ using-sticky
|
|
21
|
+
* ✔ show-scrollbar
|
|
22
|
+
* ✘ fast-deceleration
|
|
23
|
+
* ✔ binddragstart
|
|
24
|
+
* ✔ binddragging
|
|
25
|
+
* ✔ binddragend
|
|
26
|
+
* ✔ bindrefresherrefresh
|
|
27
|
+
* ✘ bindrefresherpulling
|
|
28
|
+
* ✘ bindrefresherrestore
|
|
29
|
+
* ✘ bindrefresherabort
|
|
30
|
+
* ✔ bindscrolltoupper
|
|
31
|
+
* ✔ bindscrolltolower
|
|
32
|
+
* ✔ bindscroll
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
import { View, ScrollView, RefreshControl, NativeSyntheticEvent, NativeScrollEvent, LayoutChangeEvent, ViewStyle } from 'react-native';
|
|
36
|
+
import React, { useRef, useState, useEffect, forwardRef } from 'react';
|
|
37
|
+
import useInnerProps, { getCustomEvent } from './getInnerListeners';
|
|
38
|
+
import useNodesRef, { HandlerRef } from './useNodesRef'
|
|
39
|
+
|
|
40
|
+
interface ScrollViewProps {
|
|
41
|
+
children?: React.ReactNode;
|
|
42
|
+
enhanced?: boolean;
|
|
43
|
+
bounces?: boolean;
|
|
44
|
+
style?: ViewStyle;
|
|
45
|
+
'scroll-x'?: boolean;
|
|
46
|
+
'scroll-y'?: boolean;
|
|
47
|
+
'enable-back-to-top'?: boolean;
|
|
48
|
+
'show-scrollbar'?: boolean;
|
|
49
|
+
'paging-enabled'?: boolean;
|
|
50
|
+
'upper-threshold'?: number;
|
|
51
|
+
'lower-threshold'?: number;
|
|
52
|
+
'scroll-with-animation'?: boolean;
|
|
53
|
+
'refresher-triggered'?: boolean;
|
|
54
|
+
'refresher-enabled'?: boolean;
|
|
55
|
+
'refresher-default-style'?: 'black' | 'white' | 'none';
|
|
56
|
+
'refresher-background'?: string;
|
|
57
|
+
'scroll-top'?: number;
|
|
58
|
+
'scroll-left'?: number;
|
|
59
|
+
'enable-offset'?: boolean;
|
|
60
|
+
bindscrolltoupper?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
61
|
+
bindscrolltolower?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
62
|
+
bindscroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
63
|
+
bindrefresherrefresh?: (event: NativeSyntheticEvent<unknown>) => void;
|
|
64
|
+
binddragstart?: (event: NativeSyntheticEvent<DragEvent>) => void;
|
|
65
|
+
binddragging?: (event: NativeSyntheticEvent<DragEvent>) => void;
|
|
66
|
+
binddragend?: (event: NativeSyntheticEvent<DragEvent>) => void;
|
|
67
|
+
bindtouchstart?: (event: NativeSyntheticEvent<TouchEvent>) => void;
|
|
68
|
+
bindtouchmove?: (event: NativeSyntheticEvent<TouchEvent>) => void;
|
|
69
|
+
bindtouchend?: (event: NativeSyntheticEvent<TouchEvent>) => void;
|
|
70
|
+
}
|
|
71
|
+
type ScrollAdditionalProps = {
|
|
72
|
+
pinchGestureEnabled: boolean;
|
|
73
|
+
horizontal: boolean;
|
|
74
|
+
onScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
75
|
+
onContentSizeChange: (width: number, height: number) => void;
|
|
76
|
+
onLayout?: (event: LayoutChangeEvent) => void;
|
|
77
|
+
scrollEventThrottle: number;
|
|
78
|
+
scrollsToTop: boolean;
|
|
79
|
+
showsHorizontalScrollIndicator: boolean;
|
|
80
|
+
showsVerticalScrollIndicator: boolean;
|
|
81
|
+
scrollEnabled: boolean;
|
|
82
|
+
ref: React.RefObject<ScrollView>;
|
|
83
|
+
bounces?: boolean;
|
|
84
|
+
pagingEnabled?: boolean;
|
|
85
|
+
style?: ViewStyle;
|
|
86
|
+
bindtouchstart?: (event: NativeSyntheticEvent<TouchEvent>) => void;
|
|
87
|
+
bindtouchmove?: (event: NativeSyntheticEvent<TouchEvent>) => void;
|
|
88
|
+
bindtouchend?: (event: NativeSyntheticEvent<TouchEvent>) => void;
|
|
89
|
+
};
|
|
90
|
+
const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, ScrollViewProps>((props: ScrollViewProps = {}, ref): React.JSX.Element => {
|
|
91
|
+
const {
|
|
92
|
+
children,
|
|
93
|
+
enhanced = false,
|
|
94
|
+
bounces = true,
|
|
95
|
+
'scroll-x': scrollX = false,
|
|
96
|
+
'scroll-y': scrollY = false,
|
|
97
|
+
'enable-back-to-top': enableBackToTop = false,
|
|
98
|
+
'paging-enabled': pagingEnabled = false,
|
|
99
|
+
'upper-threshold': upperThreshold = 50,
|
|
100
|
+
'lower-threshold': lowerThreshold = 50,
|
|
101
|
+
'scroll-with-animation': scrollWithAnimation,
|
|
102
|
+
'refresher-enabled': refresherEnabled,
|
|
103
|
+
'refresher-default-style': refresherDefaultStyle,
|
|
104
|
+
'refresher-background': refresherBackground,
|
|
105
|
+
'enable-offset': enableOffset,
|
|
106
|
+
'show-scrollbar': showScrollbar = true
|
|
107
|
+
} = props;
|
|
108
|
+
const [snapScrollTop, setSnapScrollTop] = useState(0);
|
|
109
|
+
const [snapScrollLeft, setSnapScrollLeft] = useState(0);
|
|
110
|
+
const [refreshing, setRefreshing] = useState(true);
|
|
111
|
+
const [scrollEnabled, setScrollEnabled] = useState(true);
|
|
112
|
+
const layoutRef = useRef({})
|
|
113
|
+
const scrollOptions = useRef({
|
|
114
|
+
contentLength: 0,
|
|
115
|
+
offset: 0,
|
|
116
|
+
scrollLeft: 0,
|
|
117
|
+
scrollTop: 0,
|
|
118
|
+
visibleLength: 0,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
const scrollEventThrottle = 50;
|
|
122
|
+
const hasCallScrollToUpper = useRef(true);
|
|
123
|
+
const hasCallScrollToLower = useRef(false);
|
|
124
|
+
const initialTimeout = useRef<ReturnType<typeof setTimeout> | null>(null)
|
|
125
|
+
|
|
126
|
+
const { nodeRef: scrollViewRef } = useNodesRef(props, ref, {
|
|
127
|
+
scrollOffset: scrollOptions,
|
|
128
|
+
node: {
|
|
129
|
+
scrollEnabled,
|
|
130
|
+
bounces,
|
|
131
|
+
showScrollbar,
|
|
132
|
+
pagingEnabled,
|
|
133
|
+
fastDeceleration: false,
|
|
134
|
+
decelerationDisabled: false,
|
|
135
|
+
scrollTo: scrollToOffset
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
if (
|
|
141
|
+
snapScrollTop !== props['scroll-top'] ||
|
|
142
|
+
snapScrollLeft !== props['scroll-left']
|
|
143
|
+
) {
|
|
144
|
+
setSnapScrollTop(props['scroll-top'] || 0);
|
|
145
|
+
setSnapScrollLeft(props['scroll-left'] || 0);
|
|
146
|
+
}
|
|
147
|
+
}, [props['scroll-top'], props['scroll-left']]);
|
|
148
|
+
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
if (refreshing !== props['refresher-triggered']) {
|
|
151
|
+
setRefreshing(!!props['refresher-triggered']);
|
|
152
|
+
}
|
|
153
|
+
}, [props['refresher-triggered']]);
|
|
154
|
+
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
if (!props['scroll-x'] && !props['scroll-y']) {
|
|
157
|
+
setScrollEnabled(false);
|
|
158
|
+
} else {
|
|
159
|
+
setScrollEnabled(true);
|
|
160
|
+
}
|
|
161
|
+
}, [props['scroll-x'], props['scroll-y']]);
|
|
162
|
+
|
|
163
|
+
useEffect(() => {
|
|
164
|
+
if (snapScrollTop || snapScrollLeft) {
|
|
165
|
+
initialTimeout.current = setTimeout(() => {
|
|
166
|
+
scrollToOffset(snapScrollLeft, snapScrollTop);
|
|
167
|
+
}, 0);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return () => {
|
|
171
|
+
initialTimeout.current && clearTimeout(initialTimeout.current);
|
|
172
|
+
};
|
|
173
|
+
}, [snapScrollTop, snapScrollLeft]);
|
|
174
|
+
|
|
175
|
+
function selectLength(size: { height: number; width: number }) {
|
|
176
|
+
return !scrollX ? size.height : size.width;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function selectOffset(position: { x: number; y: number }) {
|
|
180
|
+
return !scrollX ? position.y : position.x;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function onStartReached(e: NativeSyntheticEvent<NativeScrollEvent>) {
|
|
184
|
+
const { bindscrolltoupper } = props;
|
|
185
|
+
const { offset } = scrollOptions.current;
|
|
186
|
+
if (bindscrolltoupper && (offset <= upperThreshold)) {
|
|
187
|
+
if (!hasCallScrollToUpper.current) {
|
|
188
|
+
bindscrolltoupper(
|
|
189
|
+
getCustomEvent('scrolltoupper', e, {
|
|
190
|
+
detail: {
|
|
191
|
+
direction: scrollX ? 'left' : 'top',
|
|
192
|
+
},
|
|
193
|
+
layoutRef
|
|
194
|
+
}, props),
|
|
195
|
+
);
|
|
196
|
+
hasCallScrollToUpper.current = true;
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
hasCallScrollToUpper.current = false;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function onEndReached(e: NativeSyntheticEvent<NativeScrollEvent>) {
|
|
204
|
+
const { bindscrolltolower } = props;
|
|
205
|
+
const { contentLength, visibleLength, offset } = scrollOptions.current;
|
|
206
|
+
const distanceFromEnd = contentLength - visibleLength - offset;
|
|
207
|
+
if (bindscrolltolower && (distanceFromEnd < lowerThreshold)) {
|
|
208
|
+
if (!hasCallScrollToLower.current) {
|
|
209
|
+
hasCallScrollToLower.current = true;
|
|
210
|
+
bindscrolltolower(
|
|
211
|
+
getCustomEvent('scrolltolower', e, {
|
|
212
|
+
detail: {
|
|
213
|
+
direction: scrollX ? 'right' : 'botttom',
|
|
214
|
+
},
|
|
215
|
+
layoutRef
|
|
216
|
+
}, props),
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
} else {
|
|
220
|
+
hasCallScrollToLower.current = false;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function onContentSizeChange(width: number, height: number) {
|
|
225
|
+
scrollOptions.current.contentLength = selectLength({ height, width });
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function onLayout(e: LayoutChangeEvent) {
|
|
229
|
+
scrollOptions.current.visibleLength = selectLength(e.nativeEvent.layout);
|
|
230
|
+
if (enableOffset) {
|
|
231
|
+
scrollViewRef.current?.measure((x: number, y: number, width: number, height: number, offsetLeft: number, offsetTop: number) => {
|
|
232
|
+
layoutRef.current = { x, y, width, height, offsetLeft, offsetTop }
|
|
233
|
+
})
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function onScroll(e: NativeSyntheticEvent<NativeScrollEvent>) {
|
|
238
|
+
const { bindscroll } = props;
|
|
239
|
+
const { x: scrollLeft, y: scrollTop } = e.nativeEvent.contentOffset;
|
|
240
|
+
const { width: scrollWidth, height: scrollHeight } = e.nativeEvent.contentSize
|
|
241
|
+
bindscroll &&
|
|
242
|
+
bindscroll(
|
|
243
|
+
getCustomEvent('scroll', e, {
|
|
244
|
+
detail: {
|
|
245
|
+
scrollLeft,
|
|
246
|
+
scrollTop,
|
|
247
|
+
scrollHeight,
|
|
248
|
+
scrollWidth,
|
|
249
|
+
deltaX: scrollLeft - scrollOptions.current.scrollLeft,
|
|
250
|
+
deltaY: scrollTop - scrollOptions.current.scrollTop,
|
|
251
|
+
},
|
|
252
|
+
layoutRef
|
|
253
|
+
}, props)
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
const visibleLength = selectLength(e.nativeEvent.layoutMeasurement);
|
|
257
|
+
const contentLength = selectLength(e.nativeEvent.contentSize);
|
|
258
|
+
const offset = selectOffset(e.nativeEvent.contentOffset);
|
|
259
|
+
scrollOptions.current = {
|
|
260
|
+
...scrollOptions.current,
|
|
261
|
+
contentLength,
|
|
262
|
+
offset,
|
|
263
|
+
scrollLeft,
|
|
264
|
+
scrollTop,
|
|
265
|
+
visibleLength,
|
|
266
|
+
};
|
|
267
|
+
onStartReached(e);
|
|
268
|
+
onEndReached(e);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function scrollToOffset(x = 0, y = 0) {
|
|
272
|
+
if (scrollViewRef.current) {
|
|
273
|
+
scrollViewRef.current.scrollTo({ x, y, animated: !!scrollWithAnimation });
|
|
274
|
+
scrollOptions.current.scrollLeft = x
|
|
275
|
+
scrollOptions.current.scrollTop = y
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function onRefresh() {
|
|
280
|
+
const { bindrefresherrefresh } = props;
|
|
281
|
+
bindrefresherrefresh &&
|
|
282
|
+
bindrefresherrefresh(
|
|
283
|
+
getCustomEvent('refresherrefresh', {}, { layoutRef }, props),
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function onScrollTouchStart(e: NativeSyntheticEvent<TouchEvent>) {
|
|
288
|
+
const { binddragstart, bindtouchstart, enhanced } = props;
|
|
289
|
+
bindtouchstart && bindtouchstart(e)
|
|
290
|
+
if (enhanced) {
|
|
291
|
+
binddragstart &&
|
|
292
|
+
binddragstart(
|
|
293
|
+
getCustomEvent('dragstart', e, {
|
|
294
|
+
detail: {
|
|
295
|
+
scrollLeft: scrollOptions.current.scrollLeft || 0,
|
|
296
|
+
scrollTop: scrollOptions.current.scrollTop || 0,
|
|
297
|
+
},
|
|
298
|
+
layoutRef
|
|
299
|
+
}, props)
|
|
300
|
+
)
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function onScrollTouchMove(e: NativeSyntheticEvent<TouchEvent>) {
|
|
305
|
+
const { binddragging, bindtouchmove, enhanced } = props;
|
|
306
|
+
bindtouchmove && bindtouchmove(e)
|
|
307
|
+
if (enhanced) {
|
|
308
|
+
binddragging &&
|
|
309
|
+
binddragging(
|
|
310
|
+
getCustomEvent('dragging', e, {
|
|
311
|
+
detail: {
|
|
312
|
+
scrollLeft: scrollOptions.current.scrollLeft || 0,
|
|
313
|
+
scrollTop: scrollOptions.current.scrollTop || 0,
|
|
314
|
+
},
|
|
315
|
+
layoutRef
|
|
316
|
+
}, props)
|
|
317
|
+
)
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function onScrollTouchEnd(e: NativeSyntheticEvent<TouchEvent>) {
|
|
322
|
+
const { binddragend, bindtouchend, enhanced } = props;
|
|
323
|
+
bindtouchend && bindtouchend(e);
|
|
324
|
+
if (enhanced) {
|
|
325
|
+
binddragend &&
|
|
326
|
+
binddragend(
|
|
327
|
+
getCustomEvent('dragend', e, {
|
|
328
|
+
detail: {
|
|
329
|
+
scrollLeft: scrollOptions.current.scrollLeft || 0,
|
|
330
|
+
scrollTop: scrollOptions.current.scrollTop || 0,
|
|
331
|
+
},
|
|
332
|
+
layoutRef
|
|
333
|
+
}, props)
|
|
334
|
+
)
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
let scrollAdditionalProps: ScrollAdditionalProps = {
|
|
339
|
+
pinchGestureEnabled: false,
|
|
340
|
+
horizontal: scrollX || !scrollY,
|
|
341
|
+
scrollEventThrottle: scrollEventThrottle,
|
|
342
|
+
scrollsToTop: enableBackToTop,
|
|
343
|
+
showsHorizontalScrollIndicator: scrollX && showScrollbar,
|
|
344
|
+
showsVerticalScrollIndicator: scrollY && showScrollbar,
|
|
345
|
+
scrollEnabled: scrollEnabled,
|
|
346
|
+
ref: scrollViewRef,
|
|
347
|
+
onScroll: onScroll,
|
|
348
|
+
onContentSizeChange: onContentSizeChange,
|
|
349
|
+
bindtouchstart: onScrollTouchStart,
|
|
350
|
+
bindtouchend: onScrollTouchEnd,
|
|
351
|
+
bindtouchmove: onScrollTouchMove,
|
|
352
|
+
onLayout
|
|
353
|
+
};
|
|
354
|
+
if (enhanced) {
|
|
355
|
+
scrollAdditionalProps = {
|
|
356
|
+
...scrollAdditionalProps,
|
|
357
|
+
bounces,
|
|
358
|
+
pagingEnabled,
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
const innerProps = useInnerProps(props, scrollAdditionalProps, [
|
|
362
|
+
'enable-offset',
|
|
363
|
+
'scroll-x',
|
|
364
|
+
'scroll-y',
|
|
365
|
+
'enable-back-to-top',
|
|
366
|
+
'paging-enabled',
|
|
367
|
+
'show-scrollbar',
|
|
368
|
+
'upper-threshold',
|
|
369
|
+
'lower-threshold',
|
|
370
|
+
'scroll-top',
|
|
371
|
+
'scroll-left',
|
|
372
|
+
'scroll-with-animation',
|
|
373
|
+
'refresher-triggered',
|
|
374
|
+
'refresher-enabled',
|
|
375
|
+
'refresher-default-style',
|
|
376
|
+
'refresher-background',
|
|
377
|
+
'children',
|
|
378
|
+
'enhanced',
|
|
379
|
+
'binddragstart',
|
|
380
|
+
'binddragging',
|
|
381
|
+
'binddragend',
|
|
382
|
+
'bindscroll',
|
|
383
|
+
'bindscrolltoupper',
|
|
384
|
+
'bindscrolltolower',
|
|
385
|
+
'bindrefresherrefresh'
|
|
386
|
+
], { layoutRef });
|
|
387
|
+
|
|
388
|
+
const refreshColor = {
|
|
389
|
+
'black': ['#000'],
|
|
390
|
+
'white': ['#fff']
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
return (
|
|
394
|
+
<ScrollView
|
|
395
|
+
{...innerProps}
|
|
396
|
+
refreshControl={refresherEnabled ? (
|
|
397
|
+
<RefreshControl
|
|
398
|
+
progressBackgroundColor={refresherBackground}
|
|
399
|
+
refreshing={refreshing}
|
|
400
|
+
onRefresh={onRefresh}
|
|
401
|
+
{...(refresherDefaultStyle && refresherDefaultStyle !== 'none' ? { colors: refreshColor[refresherDefaultStyle] } : {})}
|
|
402
|
+
/>
|
|
403
|
+
) : undefined}
|
|
404
|
+
>
|
|
405
|
+
{children}
|
|
406
|
+
</ScrollView>
|
|
407
|
+
);
|
|
408
|
+
})
|
|
409
|
+
|
|
410
|
+
_ScrollView.displayName = 'mpx-scroll-view';
|
|
411
|
+
|
|
412
|
+
export default _ScrollView
|