@mpxjs/webpack-plugin 2.10.14-beta.15 → 2.10.14-beta.16
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.
|
@@ -34,7 +34,7 @@ const _SwiperItem = forwardRef((props, ref) => {
|
|
|
34
34
|
const inputRange = [step.value, 0];
|
|
35
35
|
const outputRange = [0.7, 1];
|
|
36
36
|
// 实现元素的宽度跟随step从0到真实宽度,且不能触发重新渲染整个组件,通过AnimatedStyle的方式实现
|
|
37
|
-
const outerLayoutStyle = dir === 'x' ? { width: step.value, height: '100%' } : { width: '100%', height: step.value };
|
|
37
|
+
const outerLayoutStyle = dir === 'x' ? { width: step.value || '100%', height: '100%' } : { width: '100%', height: step.value || '100%' };
|
|
38
38
|
const transformStyle = [];
|
|
39
39
|
if (scale) {
|
|
40
40
|
transformStyle.push({
|
|
@@ -4,7 +4,7 @@ import Animated, { useAnimatedStyle, useSharedValue, withTiming, Easing, runOnJS
|
|
|
4
4
|
import React, { forwardRef, useRef, useEffect, useMemo, createElement } from 'react';
|
|
5
5
|
import useInnerProps, { getCustomEvent } from './getInnerListeners';
|
|
6
6
|
import useNodesRef from './useNodesRef'; // 引入辅助函数
|
|
7
|
-
import { useTransformStyle, splitStyle, splitProps, useLayout, wrapChildren, extendObject, flatGesture, useRunOnJSCallback } from './utils';
|
|
7
|
+
import { useTransformStyle, splitStyle, splitProps, useLayout, wrapChildren, extendObject, flatGesture, useRunOnJSCallback, isHarmony } from './utils';
|
|
8
8
|
import { SwiperContext } from './context';
|
|
9
9
|
import Portal from './mpx-portal';
|
|
10
10
|
/**
|
|
@@ -807,11 +807,12 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
807
807
|
};
|
|
808
808
|
}, [gestureSwitch.current]);
|
|
809
809
|
const animatedStyles = useAnimatedStyle(() => {
|
|
810
|
+
const opacity = isHarmony ? 1 : (step.value > 0 ? 1 : 0);
|
|
810
811
|
if (dir === 'x') {
|
|
811
|
-
return { transform: [{ translateX: offset.value }], opacity
|
|
812
|
+
return { transform: [{ translateX: offset.value }], opacity };
|
|
812
813
|
}
|
|
813
814
|
else {
|
|
814
|
-
return { transform: [{ translateY: offset.value }], opacity
|
|
815
|
+
return { transform: [{ translateY: offset.value }], opacity };
|
|
815
816
|
}
|
|
816
817
|
});
|
|
817
818
|
let finalComponent;
|
|
@@ -84,7 +84,7 @@ const _SwiperItem = forwardRef<HandlerRef<View, SwiperItemProps>, SwiperItemProp
|
|
|
84
84
|
const inputRange = [step.value, 0]
|
|
85
85
|
const outputRange = [0.7, 1]
|
|
86
86
|
// 实现元素的宽度跟随step从0到真实宽度,且不能触发重新渲染整个组件,通过AnimatedStyle的方式实现
|
|
87
|
-
const outerLayoutStyle = dir === 'x' ? { width: step.value, height: '100%' } : { width: '100%', height: step.value }
|
|
87
|
+
const outerLayoutStyle = dir === 'x' ? { width: step.value || '100%', height: '100%' } : { width: '100%', height: step.value || '100%' }
|
|
88
88
|
const transformStyle = []
|
|
89
89
|
if (scale) {
|
|
90
90
|
transformStyle.push({
|
|
@@ -5,7 +5,7 @@ import Animated, { useAnimatedStyle, useSharedValue, withTiming, Easing, runOnJS
|
|
|
5
5
|
import React, { JSX, forwardRef, useRef, useEffect, ReactNode, ReactElement, useMemo, createElement } from 'react'
|
|
6
6
|
import useInnerProps, { getCustomEvent } from './getInnerListeners'
|
|
7
7
|
import useNodesRef, { HandlerRef } from './useNodesRef' // 引入辅助函数
|
|
8
|
-
import { useTransformStyle, splitStyle, splitProps, useLayout, wrapChildren, extendObject, GestureHandler, flatGesture, useRunOnJSCallback } from './utils'
|
|
8
|
+
import { useTransformStyle, splitStyle, splitProps, useLayout, wrapChildren, extendObject, GestureHandler, flatGesture, useRunOnJSCallback, isHarmony } from './utils'
|
|
9
9
|
import { SwiperContext } from './context'
|
|
10
10
|
import Portal from './mpx-portal'
|
|
11
11
|
/**
|
|
@@ -907,10 +907,11 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
907
907
|
}, [gestureSwitch.current])
|
|
908
908
|
|
|
909
909
|
const animatedStyles = useAnimatedStyle(() => {
|
|
910
|
+
const opacity = isHarmony ? 1 : (step.value > 0 ? 1 : 0)
|
|
910
911
|
if (dir === 'x') {
|
|
911
|
-
return { transform: [{ translateX: offset.value }], opacity
|
|
912
|
+
return { transform: [{ translateX: offset.value }], opacity }
|
|
912
913
|
} else {
|
|
913
|
-
return { transform: [{ translateY: offset.value }], opacity
|
|
914
|
+
return { transform: [{ translateY: offset.value }], opacity }
|
|
914
915
|
}
|
|
915
916
|
})
|
|
916
917
|
|