@mpxjs/webpack-plugin 2.10.16-perf.1 → 2.10.16-xp.1
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.
|
@@ -71,7 +71,7 @@ const easeMap = {
|
|
|
71
71
|
easeInOutCubic: Easing.inOut(Easing.cubic)
|
|
72
72
|
};
|
|
73
73
|
const SwiperWrapper = forwardRef((props, ref) => {
|
|
74
|
-
const { 'indicator-dots': showPagination, 'indicator-color': dotColor = 'rgba(0, 0, 0, .3)', 'indicator-active-color': activeDotColor = '#000000', 'enable-var': enableVar = false, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, 'external-var-context': externalVarContext, 'simultaneous-handlers': originSimultaneousHandlers = [], 'wait-for': waitFor = [], style = {}, autoplay = false, circular = false, disableGesture = false, current: propCurrent
|
|
74
|
+
const { 'indicator-dots': showPagination, 'indicator-color': dotColor = 'rgba(0, 0, 0, .3)', 'indicator-active-color': activeDotColor = '#000000', 'enable-var': enableVar = false, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, 'external-var-context': externalVarContext, 'simultaneous-handlers': originSimultaneousHandlers = [], 'wait-for': waitFor = [], style = {}, autoplay = false, circular = false, disableGesture = false, current: propCurrent, bindchange } = props;
|
|
75
75
|
const easeingFunc = props['easing-function'] || 'default';
|
|
76
76
|
const easeDuration = props.duration || 500;
|
|
77
77
|
const horizontal = props.vertical !== undefined ? !props.vertical : true;
|
|
@@ -112,10 +112,10 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
112
112
|
// 每个元素的宽度 or 高度,有固定值直接初始化无则0
|
|
113
113
|
const step = useSharedValue(initStep);
|
|
114
114
|
// 记录选中元素的索引值
|
|
115
|
-
const currentIndex = useSharedValue(propCurrent);
|
|
115
|
+
const currentIndex = useSharedValue(propCurrent || 0);
|
|
116
116
|
// const initOffset = getOffset(props.current || 0, initStep)
|
|
117
117
|
// 记录元素的偏移量
|
|
118
|
-
const offset = useSharedValue(getOffset(propCurrent, initStep));
|
|
118
|
+
const offset = useSharedValue(getOffset(propCurrent || 0, initStep));
|
|
119
119
|
const strAbso = 'absolute' + dir.toUpperCase();
|
|
120
120
|
const strVelocity = 'velocity' + dir.toUpperCase();
|
|
121
121
|
// 标识手指触摸和抬起, 起点在onBegin
|
|
@@ -170,7 +170,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
170
170
|
const iStep = dir === 'x' ? realWidth : realHeight;
|
|
171
171
|
if (iStep !== step.value) {
|
|
172
172
|
step.value = iStep;
|
|
173
|
-
updateCurrent(propCurrent, iStep);
|
|
173
|
+
updateCurrent(propCurrent || 0, iStep);
|
|
174
174
|
updateAutoplay();
|
|
175
175
|
}
|
|
176
176
|
}
|
|
@@ -414,7 +414,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
414
414
|
// 1. 如果用户在touch的过程中, 外部更新了current以外部为准(小程序表现)
|
|
415
415
|
// 2. 手指滑动过程中更新索引,外部会把current再传入进来,导致offset直接更新,增加判断不同才更新
|
|
416
416
|
if (propCurrent !== currentIndex.value) {
|
|
417
|
-
updateCurrent(propCurrent, step.value);
|
|
417
|
+
updateCurrent(propCurrent || 0, step.value);
|
|
418
418
|
}
|
|
419
419
|
}, [propCurrent]);
|
|
420
420
|
useEffect(() => {
|
|
@@ -696,6 +696,10 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
696
696
|
offset.value = moveDistance + offset.value;
|
|
697
697
|
}
|
|
698
698
|
preAbsolutePos.value = e[strAbso];
|
|
699
|
+
})
|
|
700
|
+
.onEnd((e) => {
|
|
701
|
+
// 修复部分安卓机型下onFinalize拿到的absolute值 和 onUpdate不一致的情况,通过onEnd进行修正为最终的位置
|
|
702
|
+
preAbsolutePos.value = e[strAbso];
|
|
699
703
|
})
|
|
700
704
|
.onFinalize((e) => {
|
|
701
705
|
'worklet';
|
|
@@ -148,7 +148,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
148
148
|
autoplay = false,
|
|
149
149
|
circular = false,
|
|
150
150
|
disableGesture = false,
|
|
151
|
-
current: propCurrent
|
|
151
|
+
current: propCurrent,
|
|
152
152
|
bindchange
|
|
153
153
|
} = props
|
|
154
154
|
const easeingFunc = props['easing-function'] || 'default'
|
|
@@ -199,10 +199,10 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
199
199
|
// 每个元素的宽度 or 高度,有固定值直接初始化无则0
|
|
200
200
|
const step = useSharedValue(initStep)
|
|
201
201
|
// 记录选中元素的索引值
|
|
202
|
-
const currentIndex = useSharedValue(propCurrent)
|
|
202
|
+
const currentIndex = useSharedValue(propCurrent || 0)
|
|
203
203
|
// const initOffset = getOffset(props.current || 0, initStep)
|
|
204
204
|
// 记录元素的偏移量
|
|
205
|
-
const offset = useSharedValue(getOffset(propCurrent, initStep))
|
|
205
|
+
const offset = useSharedValue(getOffset(propCurrent || 0, initStep))
|
|
206
206
|
const strAbso = 'absolute' + dir.toUpperCase() as StrAbsoType
|
|
207
207
|
const strVelocity = 'velocity' + dir.toUpperCase() as StrVelocityType
|
|
208
208
|
// 标识手指触摸和抬起, 起点在onBegin
|
|
@@ -271,7 +271,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
271
271
|
const iStep = dir === 'x' ? realWidth : realHeight
|
|
272
272
|
if (iStep !== step.value) {
|
|
273
273
|
step.value = iStep
|
|
274
|
-
updateCurrent(propCurrent, iStep)
|
|
274
|
+
updateCurrent(propCurrent || 0, iStep)
|
|
275
275
|
updateAutoplay()
|
|
276
276
|
}
|
|
277
277
|
}
|
|
@@ -520,7 +520,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
520
520
|
// 1. 如果用户在touch的过程中, 外部更新了current以外部为准(小程序表现)
|
|
521
521
|
// 2. 手指滑动过程中更新索引,外部会把current再传入进来,导致offset直接更新,增加判断不同才更新
|
|
522
522
|
if (propCurrent !== currentIndex.value) {
|
|
523
|
-
updateCurrent(propCurrent, step.value)
|
|
523
|
+
updateCurrent(propCurrent || 0, step.value)
|
|
524
524
|
}
|
|
525
525
|
}, [propCurrent])
|
|
526
526
|
|
|
@@ -790,6 +790,10 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
790
790
|
}
|
|
791
791
|
preAbsolutePos.value = e[strAbso]
|
|
792
792
|
})
|
|
793
|
+
.onEnd((e) => {
|
|
794
|
+
// 修复部分安卓机型下onFinalize拿到的absolute值 和 onUpdate不一致的情况,通过onEnd进行修正为最终的位置
|
|
795
|
+
preAbsolutePos.value = e[strAbso]
|
|
796
|
+
})
|
|
793
797
|
.onFinalize((e: GestureStateChangeEvent<PanGestureHandlerEventPayload>) => {
|
|
794
798
|
'worklet'
|
|
795
799
|
if (touchfinish.value) return
|