@mpxjs/webpack-plugin 2.10.4-beta.19-input → 2.10.4-beta.19-input1
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/runtime/components/react/dist/getInnerListeners.js +22 -36
- package/lib/runtime/components/react/dist/mpx-button.jsx +2 -7
- package/lib/runtime/components/react/dist/mpx-canvas/Image.js +4 -2
- package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +17 -20
- package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +2 -7
- package/lib/runtime/components/react/dist/mpx-checkbox.jsx +2 -7
- package/lib/runtime/components/react/dist/mpx-icon/index.jsx +2 -7
- package/lib/runtime/components/react/dist/mpx-image.jsx +20 -33
- package/lib/runtime/components/react/dist/mpx-input.jsx +9 -14
- package/lib/runtime/components/react/dist/mpx-label.jsx +2 -7
- package/lib/runtime/components/react/dist/mpx-movable-area.jsx +3 -8
- package/lib/runtime/components/react/dist/mpx-movable-view.jsx +79 -205
- package/lib/runtime/components/react/dist/mpx-picker/index.jsx +13 -11
- package/lib/runtime/components/react/dist/mpx-picker-view/index.jsx +7 -8
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.jsx +11 -29
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.jsx +5 -3
- package/lib/runtime/components/react/dist/mpx-radio-group.jsx +2 -9
- package/lib/runtime/components/react/dist/mpx-radio.jsx +2 -7
- package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +2 -10
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +51 -104
- package/lib/runtime/components/react/dist/mpx-sticky-header.jsx +1 -3
- package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +9 -11
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +141 -203
- package/lib/runtime/components/react/dist/mpx-switch.jsx +2 -7
- package/lib/runtime/components/react/dist/mpx-text.jsx +2 -7
- package/lib/runtime/components/react/dist/mpx-video.jsx +2 -7
- package/lib/runtime/components/react/dist/mpx-view.jsx +26 -28
- package/lib/runtime/components/react/dist/mpx-web-view.jsx +29 -34
- package/lib/runtime/components/react/dist/useAnimationHooks.js +89 -12
- package/lib/runtime/components/react/dist/utils.jsx +114 -199
- package/package.json +1 -1
- package/lib/runtime/components/react/dist/mpx-async-suspense.jsx +0 -145
- package/lib/runtime/components/react/dist/mpx-progress.jsx +0 -163
- package/lib/runtime/components/react/dist/mpx-slider.jsx +0 -321
|
@@ -12,7 +12,6 @@ import useInnerProps, { getCustomEvent } from './getInnerListeners';
|
|
|
12
12
|
import useNodesRef from './useNodesRef';
|
|
13
13
|
import { splitProps, splitStyle, useLayout, useTransformStyle, wrapChildren, extendObject } from './utils';
|
|
14
14
|
import Icon from './mpx-icon';
|
|
15
|
-
import Portal from './mpx-portal';
|
|
16
15
|
const styles = StyleSheet.create({
|
|
17
16
|
container: {
|
|
18
17
|
flexDirection: 'row',
|
|
@@ -74,7 +73,7 @@ const Radio = forwardRef((radioProps, ref) => {
|
|
|
74
73
|
bindtap && bindtap(getCustomEvent('tap', evt, { layoutRef }, props));
|
|
75
74
|
onChange(evt);
|
|
76
75
|
};
|
|
77
|
-
const {
|
|
76
|
+
const { hasSelfPercent, normalStyle, hasVarDec, varContextRef, setWidth, setHeight } = useTransformStyle(styleObj, { enableVar, externalVarContext, parentFontSize, parentWidth, parentHeight });
|
|
78
77
|
const { textStyle, backgroundStyle, innerStyle = {} } = splitStyle(normalStyle);
|
|
79
78
|
if (backgroundStyle) {
|
|
80
79
|
warn('Radio does not support background image-related styles!');
|
|
@@ -124,7 +123,7 @@ const Radio = forwardRef((radioProps, ref) => {
|
|
|
124
123
|
}
|
|
125
124
|
}
|
|
126
125
|
}, [checked]);
|
|
127
|
-
|
|
126
|
+
return createElement(View, innerProps, createElement(View, { style: defaultStyle }, createElement(Icon, {
|
|
128
127
|
type: 'success',
|
|
129
128
|
size: 24,
|
|
130
129
|
color: disabled ? '#E1E1E1' : color,
|
|
@@ -135,10 +134,6 @@ const Radio = forwardRef((radioProps, ref) => {
|
|
|
135
134
|
textStyle,
|
|
136
135
|
textProps
|
|
137
136
|
}));
|
|
138
|
-
if (hasPositionFixed) {
|
|
139
|
-
return createElement(Portal, null, finalComponent);
|
|
140
|
-
}
|
|
141
|
-
return finalComponent;
|
|
142
137
|
});
|
|
143
138
|
Radio.displayName = 'MpxRadio';
|
|
144
139
|
export default Radio;
|
|
@@ -8,7 +8,6 @@ import useNodesRef from '../useNodesRef'; // 引入辅助函数
|
|
|
8
8
|
import { useTransformStyle, useLayout, extendObject } from '../utils';
|
|
9
9
|
import { WebView } from 'react-native-webview';
|
|
10
10
|
import { generateHTML } from './html';
|
|
11
|
-
import Portal from '../mpx-portal';
|
|
12
11
|
function jsonToHtmlStr(elements) {
|
|
13
12
|
let htmlStr = '';
|
|
14
13
|
for (const element of elements) {
|
|
@@ -31,7 +30,7 @@ const _RichText = forwardRef((props, ref) => {
|
|
|
31
30
|
const { style = {}, nodes, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight } = props;
|
|
32
31
|
const nodeRef = useRef(null);
|
|
33
32
|
const [webViewHeight, setWebViewHeight] = useState(0);
|
|
34
|
-
const { normalStyle, hasSelfPercent, setWidth, setHeight
|
|
33
|
+
const { normalStyle, hasSelfPercent, setWidth, setHeight } = useTransformStyle(Object.assign({
|
|
35
34
|
width: '100%',
|
|
36
35
|
height: webViewHeight
|
|
37
36
|
}, style), {
|
|
@@ -52,19 +51,12 @@ const _RichText = forwardRef((props, ref) => {
|
|
|
52
51
|
layoutRef
|
|
53
52
|
});
|
|
54
53
|
const html = typeof nodes === 'string' ? nodes : jsonToHtmlStr(nodes);
|
|
55
|
-
|
|
54
|
+
return createElement(View, innerProps, createElement(WebView, {
|
|
56
55
|
source: { html: generateHTML(html) },
|
|
57
56
|
onMessage: (event) => {
|
|
58
57
|
setWebViewHeight(+event.nativeEvent.data);
|
|
59
|
-
},
|
|
60
|
-
style: {
|
|
61
|
-
backgroundColor: 'transparent'
|
|
62
58
|
}
|
|
63
59
|
}));
|
|
64
|
-
if (hasPositionFixed) {
|
|
65
|
-
finalComponent = createElement(Portal, null, finalComponent);
|
|
66
|
-
}
|
|
67
|
-
return finalComponent;
|
|
68
60
|
});
|
|
69
61
|
_RichText.displayName = 'mpx-rich-text';
|
|
70
62
|
export default _RichText;
|
|
@@ -34,13 +34,12 @@
|
|
|
34
34
|
import { ScrollView, RefreshControl, Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
35
35
|
import { Animated as RNAnimated } from 'react-native';
|
|
36
36
|
import { isValidElement, Children, useRef, useState, useEffect, forwardRef, useContext, useMemo, createElement } from 'react';
|
|
37
|
-
import Animated, { useSharedValue, withTiming, useAnimatedStyle, runOnJS } from 'react-native-reanimated';
|
|
38
|
-
import { warn
|
|
37
|
+
import Animated, { useAnimatedRef, useSharedValue, withTiming, useAnimatedStyle, runOnJS } from 'react-native-reanimated';
|
|
38
|
+
import { warn } from '@mpxjs/utils';
|
|
39
39
|
import useInnerProps, { getCustomEvent } from './getInnerListeners';
|
|
40
40
|
import useNodesRef from './useNodesRef';
|
|
41
|
-
import { splitProps, splitStyle, useTransformStyle, useLayout, wrapChildren, extendObject, flatGesture, HIDDEN_STYLE
|
|
41
|
+
import { splitProps, splitStyle, useTransformStyle, useLayout, wrapChildren, extendObject, flatGesture, HIDDEN_STYLE } from './utils';
|
|
42
42
|
import { IntersectionObserverContext, ScrollViewContext } from './context';
|
|
43
|
-
import Portal from './mpx-portal';
|
|
44
43
|
const AnimatedScrollView = RNAnimated.createAnimatedComponent(ScrollView);
|
|
45
44
|
const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
46
45
|
const { textProps, innerProps: props = {} } = splitProps(scrollViewProps);
|
|
@@ -74,29 +73,11 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
74
73
|
black: ['#000'],
|
|
75
74
|
white: ['#fff']
|
|
76
75
|
};
|
|
77
|
-
const isContentSizeChange = useRef(false);
|
|
78
76
|
const { refresherContent, otherContent } = getRefresherContent(props.children);
|
|
79
77
|
const hasRefresher = refresherContent && refresherEnabled;
|
|
80
|
-
const { normalStyle, hasVarDec, varContextRef, hasSelfPercent,
|
|
78
|
+
const { normalStyle, hasVarDec, varContextRef, hasSelfPercent, setWidth, setHeight } = useTransformStyle(style, { enableVar, externalVarContext, parentFontSize, parentWidth, parentHeight });
|
|
81
79
|
const { textStyle, innerStyle = {} } = splitStyle(normalStyle);
|
|
82
|
-
const scrollViewRef =
|
|
83
|
-
const propsRef = useRef(props);
|
|
84
|
-
const refresherStateRef = useRef({
|
|
85
|
-
hasRefresher,
|
|
86
|
-
refresherTriggered
|
|
87
|
-
});
|
|
88
|
-
propsRef.current = props;
|
|
89
|
-
refresherStateRef.current = {
|
|
90
|
-
hasRefresher,
|
|
91
|
-
refresherTriggered
|
|
92
|
-
};
|
|
93
|
-
const runOnJSCallbackRef = useRef({
|
|
94
|
-
setEnableScroll,
|
|
95
|
-
setScrollBounces,
|
|
96
|
-
setRefreshing,
|
|
97
|
-
onRefresh
|
|
98
|
-
});
|
|
99
|
-
const runOnJSCallback = useRunOnJSCallback(runOnJSCallbackRef);
|
|
80
|
+
const scrollViewRef = useAnimatedRef();
|
|
100
81
|
useNodesRef(props, ref, scrollViewRef, {
|
|
101
82
|
style: normalStyle,
|
|
102
83
|
scrollOffset: scrollOptions,
|
|
@@ -224,22 +205,7 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
224
205
|
}
|
|
225
206
|
}
|
|
226
207
|
function onContentSizeChange(width, height) {
|
|
227
|
-
|
|
228
|
-
const newContentLength = selectLength({ height, width });
|
|
229
|
-
const oldContentLength = scrollOptions.current.contentLength;
|
|
230
|
-
scrollOptions.current.contentLength = newContentLength;
|
|
231
|
-
// 内容高度变化时,Animated.event 的映射可能会有不生效的场景,所以需要手动设置一下 scrollOffset 的值
|
|
232
|
-
if (enableSticky && (__mpx_mode__ === 'android' || __mpx_mode__ === 'ios')) {
|
|
233
|
-
// 当内容变少时,检查当前滚动位置是否超出新的内容范围
|
|
234
|
-
if (newContentLength < oldContentLength) {
|
|
235
|
-
const { visibleLength, offset } = scrollOptions.current;
|
|
236
|
-
const maxOffset = Math.max(0, newContentLength - visibleLength);
|
|
237
|
-
// 如果当前滚动位置超出了新的内容范围,调整滚动offset
|
|
238
|
-
if (offset > maxOffset && scrollY) {
|
|
239
|
-
scrollOffset.setValue(maxOffset);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
208
|
+
scrollOptions.current.contentLength = selectLength({ height, width });
|
|
243
209
|
}
|
|
244
210
|
function onLayout(e) {
|
|
245
211
|
const layout = e.nativeEvent.layout || {};
|
|
@@ -259,9 +225,8 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
259
225
|
}
|
|
260
226
|
function onScroll(e) {
|
|
261
227
|
const { bindscroll } = props;
|
|
262
|
-
const {
|
|
263
|
-
const {
|
|
264
|
-
const { width: scrollWidth, height: scrollHeight } = contentSize;
|
|
228
|
+
const { x: scrollLeft, y: scrollTop } = e.nativeEvent.contentOffset;
|
|
229
|
+
const { width: scrollWidth, height: scrollHeight } = e.nativeEvent.contentSize;
|
|
265
230
|
isAtTop.value = scrollTop <= 0;
|
|
266
231
|
bindscroll &&
|
|
267
232
|
bindscroll(getCustomEvent('scroll', e, {
|
|
@@ -271,8 +236,7 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
271
236
|
scrollHeight,
|
|
272
237
|
scrollWidth,
|
|
273
238
|
deltaX: scrollLeft - scrollOptions.current.scrollLeft,
|
|
274
|
-
deltaY: scrollTop - scrollOptions.current.scrollTop
|
|
275
|
-
layoutMeasurement
|
|
239
|
+
deltaY: scrollTop - scrollOptions.current.scrollTop
|
|
276
240
|
},
|
|
277
241
|
layoutRef
|
|
278
242
|
}, props));
|
|
@@ -285,9 +249,8 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
285
249
|
}
|
|
286
250
|
function onScrollEnd(e) {
|
|
287
251
|
const { bindscrollend } = props;
|
|
288
|
-
const {
|
|
289
|
-
const {
|
|
290
|
-
const { width: scrollWidth, height: scrollHeight } = contentSize;
|
|
252
|
+
const { x: scrollLeft, y: scrollTop } = e.nativeEvent.contentOffset;
|
|
253
|
+
const { width: scrollWidth, height: scrollHeight } = e.nativeEvent.contentSize;
|
|
291
254
|
isAtTop.value = scrollTop <= 0;
|
|
292
255
|
bindscrollend &&
|
|
293
256
|
bindscrollend(getCustomEvent('scrollend', e, {
|
|
@@ -295,8 +258,7 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
295
258
|
scrollLeft,
|
|
296
259
|
scrollTop,
|
|
297
260
|
scrollHeight,
|
|
298
|
-
scrollWidth
|
|
299
|
-
layoutMeasurement
|
|
261
|
+
scrollWidth
|
|
300
262
|
},
|
|
301
263
|
layoutRef
|
|
302
264
|
}, props));
|
|
@@ -322,6 +284,20 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
322
284
|
snapScrollTop.current = y;
|
|
323
285
|
}
|
|
324
286
|
}
|
|
287
|
+
function onScrollTouchStart(e) {
|
|
288
|
+
const { bindtouchstart } = props;
|
|
289
|
+
bindtouchstart && bindtouchstart(e);
|
|
290
|
+
if (enhanced) {
|
|
291
|
+
binddragstart &&
|
|
292
|
+
binddragstart(getCustomEvent('dragstart', e, {
|
|
293
|
+
detail: {
|
|
294
|
+
scrollLeft: scrollOptions.current.scrollLeft,
|
|
295
|
+
scrollTop: scrollOptions.current.scrollTop
|
|
296
|
+
},
|
|
297
|
+
layoutRef
|
|
298
|
+
}, props));
|
|
299
|
+
}
|
|
300
|
+
}
|
|
325
301
|
function onScrollTouchMove(e) {
|
|
326
302
|
bindtouchmove && bindtouchmove(e);
|
|
327
303
|
if (enhanced) {
|
|
@@ -335,6 +311,19 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
335
311
|
}, props));
|
|
336
312
|
}
|
|
337
313
|
}
|
|
314
|
+
function onScrollTouchEnd(e) {
|
|
315
|
+
bindtouchend && bindtouchend(e);
|
|
316
|
+
if (enhanced) {
|
|
317
|
+
binddragend &&
|
|
318
|
+
binddragend(getCustomEvent('dragend', e, {
|
|
319
|
+
detail: {
|
|
320
|
+
scrollLeft: scrollOptions.current.scrollLeft || 0,
|
|
321
|
+
scrollTop: scrollOptions.current.scrollTop || 0
|
|
322
|
+
},
|
|
323
|
+
layoutRef
|
|
324
|
+
}, props));
|
|
325
|
+
}
|
|
326
|
+
}
|
|
338
327
|
function onScrollDrag(e) {
|
|
339
328
|
const { x: scrollLeft, y: scrollTop } = e.nativeEvent.contentOffset;
|
|
340
329
|
updateScrollOptions(e, { scrollLeft, scrollTop });
|
|
@@ -343,16 +332,6 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
343
332
|
const scrollHandler = RNAnimated.event([{ nativeEvent: { contentOffset: { y: scrollOffset } } }], {
|
|
344
333
|
useNativeDriver: true,
|
|
345
334
|
listener: (event) => {
|
|
346
|
-
const y = event.nativeEvent.contentOffset.y || 0;
|
|
347
|
-
// 内容高度变化时,鸿蒙中 listener 回调通过scrollOffset.__getValue获取值一直等于event.nativeEvent.contentOffset.y,值是正确的,但是无法触发 sticky 动画执行,所以需要手动再 set 一次
|
|
348
|
-
if (__mpx_mode__ === 'harmony') {
|
|
349
|
-
if (isContentSizeChange.current) {
|
|
350
|
-
scrollOffset.setValue(y);
|
|
351
|
-
setTimeout(() => {
|
|
352
|
-
isContentSizeChange.current = false;
|
|
353
|
-
}, 100);
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
335
|
onScroll(event);
|
|
357
336
|
}
|
|
358
337
|
});
|
|
@@ -360,34 +339,9 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
360
339
|
hasCallScrollToLower.current = false;
|
|
361
340
|
hasCallScrollToUpper.current = false;
|
|
362
341
|
onScrollDrag(e);
|
|
363
|
-
if (enhanced) {
|
|
364
|
-
binddragstart &&
|
|
365
|
-
binddragstart(getCustomEvent('dragstart', e, {
|
|
366
|
-
detail: {
|
|
367
|
-
scrollLeft: scrollOptions.current.scrollLeft,
|
|
368
|
-
scrollTop: scrollOptions.current.scrollTop
|
|
369
|
-
},
|
|
370
|
-
layoutRef
|
|
371
|
-
}, props));
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
function onScrollDragEnd(e) {
|
|
375
|
-
onScrollDrag(e);
|
|
376
|
-
if (enhanced) {
|
|
377
|
-
// 安卓上如果触发了默认的下拉刷新,binddragend可能不触发,只会触发 binddragstart
|
|
378
|
-
binddragend &&
|
|
379
|
-
binddragend(getCustomEvent('dragend', e, {
|
|
380
|
-
detail: {
|
|
381
|
-
scrollLeft: scrollOptions.current.scrollLeft || 0,
|
|
382
|
-
scrollTop: scrollOptions.current.scrollTop || 0
|
|
383
|
-
},
|
|
384
|
-
layoutRef
|
|
385
|
-
}, props));
|
|
386
|
-
}
|
|
387
342
|
}
|
|
388
343
|
// 处理刷新
|
|
389
344
|
function onRefresh() {
|
|
390
|
-
const { hasRefresher, refresherTriggered } = refresherStateRef.current;
|
|
391
345
|
if (hasRefresher && refresherTriggered === undefined) {
|
|
392
346
|
// 处理使用了自定义刷新组件,又没设置 refresherTriggered 的情况
|
|
393
347
|
setRefreshing(true);
|
|
@@ -399,9 +353,9 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
399
353
|
}
|
|
400
354
|
}, 500);
|
|
401
355
|
}
|
|
402
|
-
const { bindrefresherrefresh } =
|
|
356
|
+
const { bindrefresherrefresh } = props;
|
|
403
357
|
bindrefresherrefresh &&
|
|
404
|
-
bindrefresherrefresh(getCustomEvent('refresherrefresh', {}, { layoutRef },
|
|
358
|
+
bindrefresherrefresh(getCustomEvent('refresherrefresh', {}, { layoutRef }, props));
|
|
405
359
|
}
|
|
406
360
|
function getRefresherContent(children) {
|
|
407
361
|
let refresherContent = null;
|
|
@@ -449,7 +403,7 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
449
403
|
'worklet';
|
|
450
404
|
if (enableScrollValue.value !== newValue) {
|
|
451
405
|
enableScrollValue.value = newValue;
|
|
452
|
-
runOnJS(
|
|
406
|
+
runOnJS(setEnableScroll)(newValue);
|
|
453
407
|
}
|
|
454
408
|
}
|
|
455
409
|
const resetScrollState = (value) => {
|
|
@@ -460,7 +414,7 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
460
414
|
'worklet';
|
|
461
415
|
if (bouncesValue.value !== newValue) {
|
|
462
416
|
bouncesValue.value = newValue;
|
|
463
|
-
runOnJS(
|
|
417
|
+
runOnJS(setScrollBounces)(newValue);
|
|
464
418
|
}
|
|
465
419
|
}
|
|
466
420
|
// 处理下拉刷新的手势
|
|
@@ -505,7 +459,7 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
505
459
|
if ((event.translationY > 0 && translateY.value < refresherThreshold) || event.translationY < 0) {
|
|
506
460
|
translateY.value = withTiming(0);
|
|
507
461
|
updateScrollState(true);
|
|
508
|
-
runOnJS(
|
|
462
|
+
runOnJS(setRefreshing)(false);
|
|
509
463
|
}
|
|
510
464
|
else {
|
|
511
465
|
translateY.value = withTiming(refresherHeight.value);
|
|
@@ -514,22 +468,18 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
514
468
|
else if (event.translationY >= refresherHeight.value) {
|
|
515
469
|
// 触发刷新
|
|
516
470
|
translateY.value = withTiming(refresherHeight.value);
|
|
517
|
-
runOnJS(
|
|
471
|
+
runOnJS(onRefresh)();
|
|
518
472
|
}
|
|
519
473
|
else {
|
|
520
474
|
// 回弹
|
|
521
475
|
translateY.value = withTiming(0);
|
|
522
476
|
updateScrollState(true);
|
|
523
|
-
runOnJS(
|
|
477
|
+
runOnJS(setRefreshing)(false);
|
|
524
478
|
}
|
|
525
479
|
})
|
|
526
480
|
.simultaneousWithExternalGesture(scrollViewRef);
|
|
527
481
|
const scrollAdditionalProps = extendObject({
|
|
528
|
-
style: extendObject(
|
|
529
|
-
? {}
|
|
530
|
-
: {
|
|
531
|
-
flexGrow: 0
|
|
532
|
-
}, innerStyle, layoutStyle),
|
|
482
|
+
style: extendObject({}, innerStyle, layoutStyle),
|
|
533
483
|
pinchGestureEnabled: false,
|
|
534
484
|
alwaysBounceVertical: false,
|
|
535
485
|
alwaysBounceHorizontal: false,
|
|
@@ -540,13 +490,14 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
540
490
|
showsVerticalScrollIndicator: scrollY && showScrollbar,
|
|
541
491
|
scrollEnabled: !enableScroll ? false : !!(scrollX || scrollY),
|
|
542
492
|
bounces: false,
|
|
543
|
-
overScrollMode: 'never',
|
|
544
493
|
ref: scrollViewRef,
|
|
545
494
|
onScroll: enableSticky ? scrollHandler : onScroll,
|
|
546
495
|
onContentSizeChange: onContentSizeChange,
|
|
496
|
+
bindtouchstart: ((enhanced && binddragstart) || bindtouchstart) && onScrollTouchStart,
|
|
547
497
|
bindtouchmove: ((enhanced && binddragging) || bindtouchmove) && onScrollTouchMove,
|
|
498
|
+
bindtouchend: ((enhanced && binddragend) || bindtouchend) && onScrollTouchEnd,
|
|
548
499
|
onScrollBeginDrag: onScrollDragStart,
|
|
549
|
-
onScrollEndDrag:
|
|
500
|
+
onScrollEndDrag: onScrollDrag,
|
|
550
501
|
onMomentumScrollEnd: onScrollEnd
|
|
551
502
|
}, (simultaneousHandlers ? { simultaneousHandlers } : {}), (waitForHandlers ? { waitFor: waitForHandlers } : {}), layoutProps);
|
|
552
503
|
if (enhanced) {
|
|
@@ -605,11 +556,7 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
605
556
|
textStyle,
|
|
606
557
|
textProps
|
|
607
558
|
})));
|
|
608
|
-
|
|
609
|
-
if (hasPositionFixed) {
|
|
610
|
-
scrollViewComponent = createElement(Portal, null, scrollViewComponent);
|
|
611
|
-
}
|
|
612
|
-
return scrollViewComponent;
|
|
559
|
+
return hasRefresher ? withRefresherScrollView : commonScrollView;
|
|
613
560
|
});
|
|
614
561
|
_ScrollView.displayName = 'MpxScrollView';
|
|
615
562
|
export default _ScrollView;
|
|
@@ -108,9 +108,7 @@ const _StickyHeader = forwardRef((stickyHeaderProps = {}, ref) => {
|
|
|
108
108
|
const styles = StyleSheet.create({
|
|
109
109
|
content: {
|
|
110
110
|
width: '100%',
|
|
111
|
-
zIndex: 10
|
|
112
|
-
// harmony 需要手动设置 relative, zIndex 才生效
|
|
113
|
-
position: 'relative'
|
|
111
|
+
zIndex: 10
|
|
114
112
|
}
|
|
115
113
|
});
|
|
116
114
|
_StickyHeader.displayName = 'MpxStickyHeader';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Animated, { useAnimatedStyle, interpolate } from 'react-native-reanimated';
|
|
2
|
-
import { forwardRef, useRef, useContext
|
|
2
|
+
import { forwardRef, useRef, useContext } from 'react';
|
|
3
3
|
import useInnerProps from './getInnerListeners';
|
|
4
4
|
import useNodesRef from './useNodesRef'; // 引入辅助函数
|
|
5
5
|
import { useTransformStyle, splitStyle, splitProps, wrapChildren, useLayout, extendObject, isHarmony } from './utils';
|
|
@@ -45,16 +45,14 @@ const _SwiperItem = forwardRef((props, ref) => {
|
|
|
45
45
|
transform: transformStyle
|
|
46
46
|
});
|
|
47
47
|
});
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
textProps
|
|
57
|
-
}));
|
|
48
|
+
return (<Animated.View {...innerProps} style={[innerStyle, layoutStyle, itemAnimatedStyle, customStyle]} data-itemId={props['item-id']}>
|
|
49
|
+
{wrapChildren(props, {
|
|
50
|
+
hasVarDec,
|
|
51
|
+
varContext: varContextRef.current,
|
|
52
|
+
textStyle,
|
|
53
|
+
textProps
|
|
54
|
+
})}
|
|
55
|
+
</Animated.View>);
|
|
58
56
|
});
|
|
59
57
|
_SwiperItem.displayName = 'MpxSwiperItem';
|
|
60
58
|
export default _SwiperItem;
|