@mpxjs/webpack-plugin 2.9.70-alpha.0 → 2.9.71

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.
Files changed (126) hide show
  1. package/LICENSE +433 -0
  2. package/README.md +1 -1
  3. package/lib/config.js +0 -14
  4. package/lib/dependencies/ResolveDependency.js +0 -5
  5. package/lib/index.js +7 -38
  6. package/lib/json-compiler/helper.js +3 -3
  7. package/lib/loader.js +0 -53
  8. package/lib/parser.js +1 -1
  9. package/lib/platform/json/wx/index.js +21 -8
  10. package/lib/platform/style/wx/index.js +51 -54
  11. package/lib/platform/template/wx/component-config/button.js +2 -14
  12. package/lib/platform/template/wx/component-config/fix-component-name.js +15 -12
  13. package/lib/platform/template/wx/component-config/image.js +0 -4
  14. package/lib/platform/template/wx/component-config/index.js +1 -1
  15. package/lib/platform/template/wx/component-config/input.js +0 -4
  16. package/lib/platform/template/wx/component-config/movable-view.js +8 -1
  17. package/lib/platform/template/wx/component-config/picker-view.js +1 -5
  18. package/lib/platform/template/wx/component-config/rich-text.js +6 -2
  19. package/lib/platform/template/wx/component-config/scroll-view.js +1 -5
  20. package/lib/platform/template/wx/component-config/switch.js +0 -4
  21. package/lib/platform/template/wx/component-config/text.js +0 -4
  22. package/lib/platform/template/wx/component-config/textarea.js +0 -5
  23. package/lib/platform/template/wx/component-config/unsupported.js +1 -1
  24. package/lib/platform/template/wx/component-config/view.js +0 -4
  25. package/lib/platform/template/wx/index.js +1 -131
  26. package/lib/resolve-loader.js +1 -4
  27. package/lib/runtime/components/react/context.ts +8 -0
  28. package/lib/runtime/components/react/dist/context.js +2 -0
  29. package/lib/runtime/components/react/dist/getInnerListeners.js +39 -37
  30. package/lib/runtime/components/react/dist/mpx-button.jsx +16 -44
  31. package/lib/runtime/components/react/dist/mpx-canvas/html.js +2 -4
  32. package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +5 -1
  33. package/lib/runtime/components/react/dist/mpx-movable-view.jsx +93 -58
  34. package/lib/runtime/components/react/dist/mpx-navigator.jsx +1 -1
  35. package/lib/runtime/components/react/dist/mpx-picker-view-column-item.jsx +10 -14
  36. package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +94 -81
  37. package/lib/runtime/components/react/dist/mpx-picker-view.jsx +19 -16
  38. package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +10 -11
  39. package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +11 -4
  40. package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +31 -8
  41. package/lib/runtime/components/react/dist/mpx-swiper.jsx +435 -371
  42. package/lib/runtime/components/react/dist/mpx-view.jsx +18 -53
  43. package/lib/runtime/components/react/dist/pickerFaces.js +3 -8
  44. package/lib/runtime/components/react/dist/pickerVIewContext.js +5 -0
  45. package/lib/runtime/components/react/dist/{pickerViewOverlay.jsx → pickerViewIndicator.jsx} +6 -6
  46. package/lib/runtime/components/react/dist/pickerViewMask.jsx +2 -2
  47. package/lib/runtime/components/react/dist/useAnimationHooks.js +27 -10
  48. package/lib/runtime/components/react/dist/utils.jsx +162 -70
  49. package/lib/runtime/components/react/event.config.ts +25 -26
  50. package/lib/runtime/components/react/getInnerListeners.ts +236 -182
  51. package/lib/runtime/components/react/mpx-button.tsx +27 -69
  52. package/lib/runtime/components/react/mpx-canvas/html.ts +2 -4
  53. package/lib/runtime/components/react/mpx-canvas/index.tsx +44 -46
  54. package/lib/runtime/components/react/mpx-checkbox-group.tsx +15 -13
  55. package/lib/runtime/components/react/mpx-checkbox.tsx +20 -21
  56. package/lib/runtime/components/react/mpx-form.tsx +15 -20
  57. package/lib/runtime/components/react/mpx-icon.tsx +2 -2
  58. package/lib/runtime/components/react/mpx-image.tsx +87 -47
  59. package/lib/runtime/components/react/mpx-input.tsx +24 -32
  60. package/lib/runtime/components/react/mpx-label.tsx +12 -14
  61. package/lib/runtime/components/react/mpx-movable-area.tsx +10 -16
  62. package/lib/runtime/components/react/mpx-movable-view.tsx +133 -92
  63. package/lib/runtime/components/react/mpx-navigator.tsx +3 -9
  64. package/lib/runtime/components/react/mpx-picker-view-column-item.tsx +76 -0
  65. package/lib/runtime/components/react/mpx-picker-view-column.tsx +206 -183
  66. package/lib/runtime/components/react/mpx-picker-view.tsx +49 -48
  67. package/lib/runtime/components/react/mpx-radio-group.tsx +13 -15
  68. package/lib/runtime/components/react/mpx-radio.tsx +19 -25
  69. package/lib/runtime/components/react/mpx-rich-text/html.ts +40 -0
  70. package/lib/runtime/components/react/mpx-rich-text/index.tsx +115 -0
  71. package/lib/runtime/components/react/mpx-root-portal.tsx +3 -5
  72. package/lib/runtime/components/react/mpx-scroll-view.tsx +53 -43
  73. package/lib/runtime/components/react/mpx-swiper-item.tsx +45 -11
  74. package/lib/runtime/components/react/mpx-swiper.tsx +742 -0
  75. package/lib/runtime/components/react/mpx-switch.tsx +19 -15
  76. package/lib/runtime/components/react/mpx-text.tsx +8 -16
  77. package/lib/runtime/components/react/mpx-textarea.tsx +11 -10
  78. package/lib/runtime/components/react/mpx-view.tsx +28 -77
  79. package/lib/runtime/components/react/mpx-web-view.tsx +94 -59
  80. package/lib/runtime/components/react/pickerFaces.ts +10 -7
  81. package/lib/runtime/components/react/pickerVIewContext.ts +27 -0
  82. package/lib/runtime/components/react/pickerViewIndicator.tsx +34 -0
  83. package/lib/runtime/components/react/pickerViewMask.tsx +30 -0
  84. package/lib/runtime/components/react/types/{getInnerListeners.ts → getInnerListeners.d.ts} +4 -5
  85. package/lib/runtime/components/react/types/global.d.ts +12 -1
  86. package/lib/runtime/components/react/useAnimationHooks.ts +60 -15
  87. package/lib/runtime/components/react/utils.tsx +175 -71
  88. package/lib/runtime/components/web/mpx-checkbox.vue +1 -1
  89. package/lib/runtime/components/web/mpx-picker-view-column.vue +9 -4
  90. package/lib/runtime/components/web/mpx-web-view.vue +34 -20
  91. package/lib/runtime/optionProcessor.js +0 -22
  92. package/lib/style-compiler/index.js +1 -1
  93. package/lib/style-compiler/plugins/scope-id.js +30 -2
  94. package/lib/template-compiler/compiler.js +91 -39
  95. package/lib/utils/env.js +1 -6
  96. package/lib/utils/pre-process-json.js +9 -5
  97. package/lib/wxss/loader.js +15 -2
  98. package/package.json +4 -7
  99. package/lib/dependencies/AddEntryDependency.js +0 -24
  100. package/lib/runtime/components/react/dist/types/common.js +0 -1
  101. package/lib/runtime/components/react/dist/types/getInnerListeners.js +0 -1
  102. package/lib/runtime/components/react/mpx-swiper/carouse.tsx +0 -527
  103. package/lib/runtime/components/react/mpx-swiper/index.tsx +0 -80
  104. package/lib/runtime/components/react/mpx-swiper/type.ts +0 -87
  105. package/lib/runtime/components/react/pickerOverlay.tsx +0 -32
  106. package/lib/runtime/components/tenon/getInnerListeners.js +0 -334
  107. package/lib/runtime/components/tenon/tenon-button.vue +0 -309
  108. package/lib/runtime/components/tenon/tenon-image.vue +0 -66
  109. package/lib/runtime/components/tenon/tenon-input.vue +0 -171
  110. package/lib/runtime/components/tenon/tenon-rich-text.vue +0 -26
  111. package/lib/runtime/components/tenon/tenon-scroll-view.vue +0 -127
  112. package/lib/runtime/components/tenon/tenon-switch.vue +0 -96
  113. package/lib/runtime/components/tenon/tenon-text.vue +0 -70
  114. package/lib/runtime/components/tenon/tenon-textarea.vue +0 -86
  115. package/lib/runtime/components/tenon/tenon-view.vue +0 -93
  116. package/lib/runtime/components/web/event.js +0 -105
  117. package/lib/runtime/optionProcessor.tenon.js +0 -84
  118. package/lib/style-compiler/plugins/hm.js +0 -20
  119. package/lib/tenon/index.js +0 -117
  120. package/lib/tenon/processJSON.js +0 -352
  121. package/lib/tenon/processScript.js +0 -203
  122. package/lib/tenon/processStyles.js +0 -21
  123. package/lib/tenon/processTemplate.js +0 -126
  124. package/lib/tenon/script-helper.js +0 -223
  125. package/lib/utils/get-relative-path.js +0 -25
  126. /package/lib/runtime/components/react/types/{common.ts → common.d.ts} +0 -0
@@ -10,9 +10,10 @@ import useInnerProps from './getInnerListeners';
10
10
  import Animated from 'react-native-reanimated';
11
11
  import useAnimationHooks from './useAnimationHooks';
12
12
  import useNodesRef from './useNodesRef';
13
- import { parseUrl, PERCENT_REGEX, splitStyle, splitProps, useTransformStyle, wrapChildren, useLayout, renderImage, pickStyle, extendObject } from './utils';
13
+ import { parseUrl, PERCENT_REGEX, splitStyle, splitProps, useTransformStyle, wrapChildren, useLayout, renderImage, pickStyle, extendObject, useHover } from './utils';
14
14
  import { error } from '@mpxjs/utils';
15
15
  import LinearGradient from 'react-native-linear-gradient';
16
+ import { GestureDetector } from 'react-native-gesture-handler';
16
17
  const linearMap = new Map([
17
18
  ['top', 0],
18
19
  ['bottom', 180],
@@ -441,7 +442,7 @@ function inheritStyle(innerStyle = {}) {
441
442
  }
442
443
  : undefined);
443
444
  }
444
- function wrapImage(imageStyle, innerStyle, enableFastImage) {
445
+ function useWrapImage(imageStyle, innerStyle, enableFastImage) {
445
446
  // 预处理数据
446
447
  const preImageInfo = preParseImage(imageStyle);
447
448
  // 预解析
@@ -534,14 +535,14 @@ function wrapWithChildren(props, { hasVarDec, enableBackground, textStyle, backg
534
535
  textProps
535
536
  });
536
537
  return [
537
- enableBackground ? wrapImage(backgroundStyle, innerStyle, enableFastImage) : null,
538
+ // eslint-disable-next-line react-hooks/rules-of-hooks
539
+ enableBackground ? useWrapImage(backgroundStyle, innerStyle, enableFastImage) : null,
538
540
  children
539
541
  ];
540
542
  }
541
543
  const _View = forwardRef((viewProps, ref) => {
542
544
  const { textProps, innerProps: props = {} } = splitProps(viewProps);
543
545
  let { style = {}, 'hover-style': hoverStyle, 'hover-start-time': hoverStartTime = 50, 'hover-stay-time': hoverStayTime = 400, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'enable-background': enableBackground, 'enable-fast-image': enableFastImage, 'enable-animation': enableAnimation, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, animation } = props;
544
- const [isHover, setIsHover] = useState(false);
545
546
  // 默认样式
546
547
  const defaultStyle = style.display === 'flex'
547
548
  ? {
@@ -551,6 +552,8 @@ const _View = forwardRef((viewProps, ref) => {
551
552
  flexWrap: 'nowrap'
552
553
  }
553
554
  : {};
555
+ const enableHover = !!hoverStyle;
556
+ const { isHover, gesture } = useHover({ enableHover, hoverStartTime, hoverStayTime });
554
557
  const styleObj = extendObject({}, defaultStyle, style, isHover ? hoverStyle : {});
555
558
  const { normalStyle, hasSelfPercent, hasVarDec, varContextRef, setWidth, setHeight } = useTransformStyle(styleObj, {
556
559
  enableVar,
@@ -569,58 +572,17 @@ const _View = forwardRef((viewProps, ref) => {
569
572
  useNodesRef(props, ref, nodeRef, {
570
573
  style: normalStyle
571
574
  });
572
- const dataRef = useRef({});
573
- useEffect(() => {
574
- return () => {
575
- dataRef.current.startTimer && clearTimeout(dataRef.current.startTimer);
576
- dataRef.current.stayTimer && clearTimeout(dataRef.current.stayTimer);
577
- };
578
- }, []);
579
- const setStartTimer = () => {
580
- dataRef.current.startTimer && clearTimeout(dataRef.current.startTimer);
581
- dataRef.current.startTimer = setTimeout(() => {
582
- setIsHover(true);
583
- }, +hoverStartTime);
584
- };
585
- const setStayTimer = () => {
586
- dataRef.current.stayTimer && clearTimeout(dataRef.current.stayTimer);
587
- dataRef.current.startTimer && clearTimeout(dataRef.current.startTimer);
588
- dataRef.current.stayTimer = setTimeout(() => {
589
- setIsHover(false);
590
- }, +hoverStayTime);
591
- };
592
- function onTouchStart(e) {
593
- const { bindtouchstart } = props;
594
- bindtouchstart && bindtouchstart(e);
595
- setStartTimer();
596
- }
597
- function onTouchEnd(e) {
598
- const { bindtouchend } = props;
599
- bindtouchend && bindtouchend(e);
600
- setStayTimer();
601
- }
602
575
  const { layoutRef, layoutStyle, layoutProps } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef });
603
576
  const viewStyle = extendObject({}, innerStyle, layoutStyle);
604
- enableAnimation = enableAnimation || !!animation;
605
- const enableAnimationRef = useRef(enableAnimation);
606
- if (enableAnimationRef.current !== enableAnimation) {
607
- error('[Mpx runtime error]: animation use should be stable in the component lifecycle, or you can set [enable-animation] with true.');
608
- }
609
- const finalStyle = enableAnimationRef.current
610
- ? [viewStyle, useAnimationHooks({
611
- animation,
612
- style: viewStyle
613
- })]
614
- : viewStyle;
577
+ const { enableStyleAnimation, animationStyle } = useAnimationHooks({
578
+ enableAnimation,
579
+ animation,
580
+ style: viewStyle
581
+ });
615
582
  const innerProps = useInnerProps(props, extendObject({
616
583
  ref: nodeRef,
617
- style: finalStyle
618
- }, layoutProps, hoverStyle
619
- ? {
620
- bindtouchstart: onTouchStart,
621
- bindtouchend: onTouchEnd
622
- }
623
- : {}), [
584
+ style: enableStyleAnimation ? [viewStyle, animationStyle] : viewStyle
585
+ }, layoutProps), [
624
586
  'hover-start-time',
625
587
  'hover-stay-time',
626
588
  'hover-style',
@@ -638,9 +600,12 @@ const _View = forwardRef((viewProps, ref) => {
638
600
  innerStyle,
639
601
  enableFastImage
640
602
  });
641
- return enableAnimation
603
+ const BaseComponent = enableStyleAnimation
642
604
  ? createElement(Animated.View, innerProps, childNode)
643
605
  : createElement(View, innerProps, childNode);
606
+ return enableHover
607
+ ? createElement(GestureDetector, { gesture: gesture }, BaseComponent)
608
+ : BaseComponent;
644
609
  });
645
610
  _View.displayName = 'MpxView';
646
611
  export default _View;
@@ -30,9 +30,6 @@ export const createFaces = (itemHeight, visibleCount) => {
30
30
  for (let i = 0; i < index; i++) {
31
31
  offset += freeSpaces[i];
32
32
  }
33
- if (index === 0) {
34
- offset *= 0.6;
35
- }
36
33
  return offset;
37
34
  });
38
35
  return [screenHeights, offsets];
@@ -41,15 +38,13 @@ export const createFaces = (itemHeight, visibleCount) => {
41
38
  const map = {
42
39
  0: 0,
43
40
  1: 0.8,
44
- 2: 0.9 // 0.35
45
- // 3: 0.45, // 0.45
46
- // 4: 0.5 // 0.5
41
+ 2: 0.9
47
42
  };
48
43
  return map[index] ?? Math.min(1, map[2] + index * 0.05);
49
44
  };
50
45
  const degrees = getDegreesRelativeCenter();
51
46
  const [screenHeight, offsets] = getScreenHeightsAndOffsets(degrees);
52
- const scales = [1, 0.925, 0.8];
47
+ const scales = [0.973, 0.9, 0.8];
53
48
  return [
54
49
  // top items
55
50
  ...degrees
@@ -65,7 +60,7 @@ export const createFaces = (itemHeight, visibleCount) => {
65
60
  })
66
61
  .reverse(),
67
62
  // center item
68
- { index: 0, deg: 0, opacity: 1, offsetY: 0, scale: 1.031, screenHeight: itemHeight },
63
+ { index: 0, deg: 0, opacity: 1, offsetY: 0, scale: 1, screenHeight: itemHeight },
69
64
  // bottom items
70
65
  ...degrees.map((degree, index) => {
71
66
  return {
@@ -7,3 +7,8 @@ export const usePickerViewColumnAnimationContext = () => {
7
7
  }
8
8
  return value;
9
9
  };
10
+ export const PickerViewStyleContext = createContext(undefined);
11
+ export const usePickerViewStyleContext = () => {
12
+ const value = useContext(PickerViewStyleContext);
13
+ return value;
14
+ };
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
2
  import { StyleSheet, View } from 'react-native';
3
- const _PickerViewOverlay = ({ itemHeight, overlayItemStyle, overlayContainerStyle }) => {
4
- return (<View style={[styles.overlayContainer, overlayContainerStyle]} pointerEvents={'none'}>
5
- <View style={[styles.selection, { height: itemHeight }, overlayItemStyle]}/>
3
+ const _PickerViewIndicator = ({ itemHeight, indicatorItemStyle, indicatorContainerStyle }) => {
4
+ return (<View style={[styles.indicatorContainer, indicatorContainerStyle]} pointerEvents={'none'}>
5
+ <View style={[styles.selection, { height: itemHeight }, indicatorItemStyle]}/>
6
6
  </View>);
7
7
  };
8
8
  const styles = StyleSheet.create({
9
- overlayContainer: {
9
+ indicatorContainer: {
10
10
  ...StyleSheet.absoluteFillObject,
11
11
  justifyContent: 'center',
12
12
  alignItems: 'center',
@@ -19,5 +19,5 @@ const styles = StyleSheet.create({
19
19
  alignSelf: 'stretch'
20
20
  }
21
21
  });
22
- _PickerViewOverlay.displayName = 'MpxPickerViewOverlay';
23
- export default _PickerViewOverlay;
22
+ _PickerViewIndicator.displayName = 'MpxPickerViewIndicator';
23
+ export default _PickerViewIndicator;
@@ -2,14 +2,14 @@ import React from 'react';
2
2
  import { StyleSheet, View } from 'react-native';
3
3
  import LinearGradient from 'react-native-linear-gradient';
4
4
  const _PickerViewMask = ({ itemHeight, maskContainerStyle }) => {
5
- return (<View style={[styles.overlayContainer, maskContainerStyle]} pointerEvents={'none'}>
5
+ return (<View style={[styles.maskContainer, maskContainerStyle]} pointerEvents={'none'}>
6
6
  <LinearGradient colors={['rgba(255,255,255,1)', 'rgba(255,255,255,0.5)']} style={{ flex: 1 }}/>
7
7
  <View style={{ height: itemHeight }}/>
8
8
  <LinearGradient colors={['rgba(255,255,255,0.5)', 'rgba(255,255,255,1)']} style={{ flex: 1 }}/>
9
9
  </View>);
10
10
  };
11
11
  const styles = StyleSheet.create({
12
- overlayContainer: {
12
+ maskContainer: {
13
13
  ...StyleSheet.absoluteFillObject,
14
14
  zIndex: 100
15
15
  }
@@ -1,5 +1,6 @@
1
1
  import { useEffect, useMemo, useRef } from 'react';
2
2
  import { Easing, useSharedValue, withTiming, useAnimatedStyle, withSequence, withDelay, makeMutable, cancelAnimation } from 'react-native-reanimated';
3
+ import { error } from '@mpxjs/utils';
3
4
  // 微信 timingFunction 和 RN Easing 对应关系
4
5
  const EasingKey = {
5
6
  linear: Easing.linear,
@@ -75,7 +76,7 @@ const parseTransform = (transformStr) => {
75
76
  const values = parseValues(transformStr);
76
77
  const transform = [];
77
78
  values.forEach(item => {
78
- const match = item.match(/([/\w]+)\(([^)]+)\)/);
79
+ const match = item.match(/([/\w]+)\((.+)\)/);
79
80
  if (match && match.length >= 3) {
80
81
  let key = match[1];
81
82
  const val = match[2];
@@ -132,19 +133,29 @@ const formatStyle = (style) => {
132
133
  });
133
134
  };
134
135
  export default function useAnimationHooks(props) {
135
- const { style = {}, animation } = props;
136
+ const { style = {}, animation, enableAnimation } = props;
137
+ const enableStyleAnimation = enableAnimation || !!animation;
138
+ const enableAnimationRef = useRef(enableStyleAnimation);
139
+ if (enableAnimationRef.current !== enableStyleAnimation) {
140
+ error('[Mpx runtime error]: animation use should be stable in the component lifecycle, or you can set [enable-animation] with true.');
141
+ }
142
+ if (!enableAnimationRef.current)
143
+ return { enableStyleAnimation: false };
136
144
  const originalStyle = formatStyle(style);
137
145
  // id 标识
138
146
  const id = animation?.id || -1;
139
147
  // 有动画样式的 style key
148
+ // eslint-disable-next-line react-hooks/rules-of-hooks
140
149
  const animatedStyleKeys = useSharedValue([]);
141
150
  // 记录动画key的style样式值 没有的话设置为false
151
+ // eslint-disable-next-line react-hooks/rules-of-hooks
142
152
  const animatedKeys = useRef({});
143
153
  // const animatedKeys = useRef({} as {[propName: keyof ExtendedViewStyle]: boolean|number|string})
144
154
  // ** 全量 style prop sharedValue
145
155
  // 不能做增量的原因:
146
156
  // 1 尝试用 useRef,但 useAnimatedStyle 访问后的 ref 不能在增加新的值,被冻结
147
157
  // 2 尝试用 useSharedValue,因为实际触发的 style prop 需要是 sharedValue 才能驱动动画,若外层 shareValMap 也是 sharedValue,动画无法驱动。
158
+ // eslint-disable-next-line react-hooks/rules-of-hooks
148
159
  const shareValMap = useMemo(() => {
149
160
  return Object.keys(InitialValue).reduce((valMap, key) => {
150
161
  const defaultVal = getInitialVal(key, isTransform(key));
@@ -153,6 +164,7 @@ export default function useAnimationHooks(props) {
153
164
  }, {});
154
165
  }, []);
155
166
  // ** 获取动画样式prop & 驱动动画
167
+ // eslint-disable-next-line react-hooks/rules-of-hooks
156
168
  useEffect(() => {
157
169
  if (id === -1)
158
170
  return;
@@ -174,6 +186,7 @@ export default function useAnimationHooks(props) {
174
186
  // })
175
187
  // }, [style])
176
188
  // ** 清空动画
189
+ // eslint-disable-next-line react-hooks/rules-of-hooks
177
190
  useEffect(() => {
178
191
  return () => {
179
192
  Object.values(shareValMap).forEach((value) => {
@@ -206,14 +219,13 @@ export default function useAnimationHooks(props) {
206
219
  }
207
220
  // 添加每个key的多次step动画
208
221
  animatedKeys.forEach(key => {
222
+ const ruleV = isTransform(key) ? transform.get(key) : rules.get(key);
209
223
  // key不存在,第一轮取shareValMap[key]value,非第一轮取上一轮的
210
- const toVal = rules.get(key) !== undefined
211
- ? rules.get(key)
212
- : transform.get(key) !== undefined
213
- ? transform.get(key)
214
- : index > 0
215
- ? lastValueMap[key]
216
- : shareValMap[key].value;
224
+ const toVal = ruleV !== undefined
225
+ ? ruleV
226
+ : index > 0
227
+ ? lastValueMap[key]
228
+ : shareValMap[key].value;
217
229
  const animation = getAnimation({ key, value: toVal }, { delay, duration, easing }, needSetCallback ? setTransformOrigin : undefined);
218
230
  needSetCallback = false;
219
231
  if (!sequence[key]) {
@@ -307,7 +319,8 @@ export default function useAnimationHooks(props) {
307
319
  }, {});
308
320
  }
309
321
  // ** 生成动画样式
310
- return useAnimatedStyle(() => {
322
+ // eslint-disable-next-line react-hooks/rules-of-hooks
323
+ const animationStyle = useAnimatedStyle(() => {
311
324
  // console.info(`useAnimatedStyle styles=`, originalStyle)
312
325
  return animatedStyleKeys.value.reduce((styles, key) => {
313
326
  // console.info('getAnimationStyles', key, shareValMap[key].value)
@@ -326,4 +339,8 @@ export default function useAnimationHooks(props) {
326
339
  return styles;
327
340
  }, {});
328
341
  });
342
+ return {
343
+ enableStyleAnimation: enableAnimationRef.current,
344
+ animationStyle
345
+ };
329
346
  }