@mpxjs/webpack-plugin 2.10.3 → 2.10.4-beta.10

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 (155) hide show
  1. package/lib/config.js +2 -1
  2. package/lib/index.js +1 -1
  3. package/lib/platform/json/wx/index.js +6 -4
  4. package/lib/platform/style/wx/index.js +42 -30
  5. package/lib/platform/template/wx/component-config/button.js +20 -3
  6. package/lib/platform/template/wx/component-config/canvas.js +4 -0
  7. package/lib/platform/template/wx/component-config/checkbox-group.js +4 -0
  8. package/lib/platform/template/wx/component-config/checkbox.js +4 -0
  9. package/lib/platform/template/wx/component-config/cover-image.js +7 -1
  10. package/lib/platform/template/wx/component-config/cover-view.js +4 -0
  11. package/lib/platform/template/wx/component-config/fix-component-name.js +3 -2
  12. package/lib/platform/template/wx/component-config/form.js +7 -1
  13. package/lib/platform/template/wx/component-config/icon.js +4 -0
  14. package/lib/platform/template/wx/component-config/image.js +7 -1
  15. package/lib/platform/template/wx/component-config/index.js +5 -1
  16. package/lib/platform/template/wx/component-config/input.js +19 -4
  17. package/lib/platform/template/wx/component-config/label.js +4 -0
  18. package/lib/platform/template/wx/component-config/movable-area.js +7 -1
  19. package/lib/platform/template/wx/component-config/movable-view.js +12 -3
  20. package/lib/platform/template/wx/component-config/navigator.js +4 -0
  21. package/lib/platform/template/wx/component-config/picker-view-column.js +4 -0
  22. package/lib/platform/template/wx/component-config/picker-view.js +7 -1
  23. package/lib/platform/template/wx/component-config/picker.js +7 -1
  24. package/lib/platform/template/wx/component-config/radio-group.js +4 -0
  25. package/lib/platform/template/wx/component-config/radio.js +4 -0
  26. package/lib/platform/template/wx/component-config/rich-text.js +4 -0
  27. package/lib/platform/template/wx/component-config/root-portal.js +4 -0
  28. package/lib/platform/template/wx/component-config/scroll-view.js +10 -2
  29. package/lib/platform/template/wx/component-config/sticky-header.js +23 -0
  30. package/lib/platform/template/wx/component-config/sticky-section.js +23 -0
  31. package/lib/platform/template/wx/component-config/swiper-item.js +7 -1
  32. package/lib/platform/template/wx/component-config/swiper.js +12 -3
  33. package/lib/platform/template/wx/component-config/switch.js +4 -0
  34. package/lib/platform/template/wx/component-config/text.js +24 -3
  35. package/lib/platform/template/wx/component-config/textarea.js +17 -2
  36. package/lib/platform/template/wx/component-config/unsupported.js +7 -0
  37. package/lib/platform/template/wx/component-config/video.js +10 -2
  38. package/lib/platform/template/wx/component-config/view.js +11 -1
  39. package/lib/platform/template/wx/component-config/web-view.js +4 -0
  40. package/lib/platform/template/wx/index.js +42 -75
  41. package/lib/react/processJSON.js +7 -6
  42. package/lib/react/processScript.js +1 -18
  43. package/lib/runtime/components/react/context.ts +12 -3
  44. package/lib/runtime/components/react/dist/context.js +4 -1
  45. package/lib/runtime/components/react/dist/event.config.js +0 -1
  46. package/lib/runtime/components/react/dist/getInnerListeners.js +127 -142
  47. package/lib/runtime/components/react/dist/mpx-button.jsx +4 -5
  48. package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +4 -5
  49. package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +2 -2
  50. package/lib/runtime/components/react/dist/mpx-checkbox.jsx +2 -3
  51. package/lib/runtime/components/react/dist/mpx-form.jsx +2 -2
  52. package/lib/runtime/components/react/dist/mpx-icon/index.jsx +2 -2
  53. package/lib/runtime/components/react/dist/mpx-image.jsx +2 -2
  54. package/lib/runtime/components/react/dist/mpx-inline-text.jsx +11 -0
  55. package/lib/runtime/components/react/dist/mpx-input.jsx +20 -17
  56. package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +24 -31
  57. package/lib/runtime/components/react/dist/mpx-label.jsx +2 -3
  58. package/lib/runtime/components/react/dist/mpx-movable-area.jsx +2 -2
  59. package/lib/runtime/components/react/dist/mpx-movable-view.jsx +1 -1
  60. package/lib/runtime/components/react/dist/mpx-navigator.jsx +11 -3
  61. package/lib/runtime/components/react/dist/mpx-picker/date.jsx +194 -68
  62. package/lib/runtime/components/react/dist/mpx-picker/dateData.js +17 -0
  63. package/lib/runtime/components/react/dist/mpx-picker/index.jsx +180 -98
  64. package/lib/runtime/components/react/dist/mpx-picker/multiSelector.jsx +79 -139
  65. package/lib/runtime/components/react/dist/mpx-picker/region.jsx +190 -90
  66. package/lib/runtime/components/react/dist/mpx-picker/selector.jsx +60 -75
  67. package/lib/runtime/components/react/dist/mpx-picker/time.jsx +100 -228
  68. package/lib/runtime/components/react/dist/{mpx-picker-view.jsx → mpx-picker-view/index.jsx} +5 -6
  69. package/lib/runtime/components/react/dist/{mpx-picker-view-column.jsx → mpx-picker-view-column/index.jsx} +64 -16
  70. package/lib/runtime/components/react/dist/{mpx-picker-view-column-item.jsx → mpx-picker-view-column/pickerViewColumnItem.jsx} +8 -5
  71. package/lib/runtime/components/react/dist/{pickerFaces.js → mpx-picker-view-column/pickerViewFaces.js} +6 -0
  72. package/lib/runtime/components/react/dist/mpx-popup/index.jsx +61 -0
  73. package/lib/runtime/components/react/dist/mpx-popup/popupBase.jsx +92 -0
  74. package/lib/runtime/components/react/dist/mpx-radio-group.jsx +2 -2
  75. package/lib/runtime/components/react/dist/mpx-radio.jsx +2 -3
  76. package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +2 -2
  77. package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +207 -29
  78. package/lib/runtime/components/react/dist/mpx-simple-text.jsx +7 -5
  79. package/lib/runtime/components/react/dist/mpx-simple-view.jsx +11 -15
  80. package/lib/runtime/components/react/dist/mpx-sticky-header.jsx +115 -0
  81. package/lib/runtime/components/react/dist/mpx-sticky-section.jsx +45 -0
  82. package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +4 -5
  83. package/lib/runtime/components/react/dist/mpx-swiper.jsx +9 -9
  84. package/lib/runtime/components/react/dist/mpx-switch.jsx +3 -5
  85. package/lib/runtime/components/react/dist/mpx-text.jsx +4 -7
  86. package/lib/runtime/components/react/dist/mpx-video.jsx +5 -5
  87. package/lib/runtime/components/react/dist/mpx-view.jsx +23 -9
  88. package/lib/runtime/components/react/dist/mpx-web-view.jsx +16 -13
  89. package/lib/runtime/components/react/dist/useAnimationHooks.js +26 -4
  90. package/lib/runtime/components/react/dist/utils.jsx +14 -2
  91. package/lib/runtime/components/react/event.config.ts +1 -6
  92. package/lib/runtime/components/react/getInnerListeners.ts +148 -191
  93. package/lib/runtime/components/react/mpx-button.tsx +7 -7
  94. package/lib/runtime/components/react/mpx-canvas/index.tsx +25 -17
  95. package/lib/runtime/components/react/mpx-checkbox-group.tsx +4 -3
  96. package/lib/runtime/components/react/mpx-checkbox.tsx +8 -9
  97. package/lib/runtime/components/react/mpx-form.tsx +25 -19
  98. package/lib/runtime/components/react/mpx-icon/index.tsx +4 -3
  99. package/lib/runtime/components/react/mpx-image.tsx +4 -3
  100. package/lib/runtime/components/react/mpx-inline-text.tsx +18 -0
  101. package/lib/runtime/components/react/mpx-input.tsx +24 -21
  102. package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +31 -42
  103. package/lib/runtime/components/react/mpx-label.tsx +4 -5
  104. package/lib/runtime/components/react/mpx-movable-area.tsx +22 -13
  105. package/lib/runtime/components/react/mpx-movable-view.tsx +47 -40
  106. package/lib/runtime/components/react/mpx-navigator.tsx +4 -6
  107. package/lib/runtime/components/react/mpx-picker/date.tsx +226 -69
  108. package/lib/runtime/components/react/mpx-picker/dateData.ts +22 -0
  109. package/lib/runtime/components/react/mpx-picker/index.tsx +242 -118
  110. package/lib/runtime/components/react/mpx-picker/multiSelector.tsx +96 -139
  111. package/lib/runtime/components/react/mpx-picker/region.tsx +217 -89
  112. package/lib/runtime/components/react/mpx-picker/selector.tsx +75 -80
  113. package/lib/runtime/components/react/mpx-picker/time.tsx +119 -236
  114. package/lib/runtime/components/react/mpx-picker/type.ts +85 -71
  115. package/lib/runtime/components/react/{mpx-picker-view.tsx → mpx-picker-view/index.tsx} +24 -21
  116. package/lib/runtime/components/react/{mpx-picker-view-column.tsx → mpx-picker-view-column/index.tsx} +70 -19
  117. package/lib/runtime/components/react/{mpx-picker-view-column-item.tsx → mpx-picker-view-column/pickerViewColumnItem.tsx} +8 -5
  118. package/lib/runtime/components/react/{pickerFaces.ts → mpx-picker-view-column/pickerViewFaces.ts} +7 -0
  119. package/lib/runtime/components/react/mpx-popup/index.tsx +86 -0
  120. package/lib/runtime/components/react/mpx-popup/popupBase.tsx +130 -0
  121. package/lib/runtime/components/react/mpx-radio-group.tsx +4 -3
  122. package/lib/runtime/components/react/mpx-radio.tsx +8 -9
  123. package/lib/runtime/components/react/mpx-rich-text/index.tsx +15 -6
  124. package/lib/runtime/components/react/mpx-scroll-view.tsx +326 -96
  125. package/lib/runtime/components/react/mpx-simple-text.tsx +17 -8
  126. package/lib/runtime/components/react/mpx-simple-view.tsx +17 -16
  127. package/lib/runtime/components/react/mpx-sticky-header.tsx +179 -0
  128. package/lib/runtime/components/react/mpx-sticky-section.tsx +96 -0
  129. package/lib/runtime/components/react/mpx-swiper-item.tsx +31 -24
  130. package/lib/runtime/components/react/mpx-swiper.tsx +67 -61
  131. package/lib/runtime/components/react/mpx-switch.tsx +19 -14
  132. package/lib/runtime/components/react/mpx-text.tsx +16 -13
  133. package/lib/runtime/components/react/mpx-video.tsx +36 -35
  134. package/lib/runtime/components/react/mpx-view.tsx +41 -17
  135. package/lib/runtime/components/react/mpx-web-view.tsx +15 -12
  136. package/lib/runtime/components/react/types/getInnerListeners.d.ts +69 -35
  137. package/lib/runtime/components/react/types/global.d.ts +1 -1
  138. package/lib/runtime/components/react/useAnimationHooks.ts +29 -9
  139. package/lib/runtime/components/react/utils.tsx +15 -3
  140. package/lib/runtime/components/web/mini-video-controls.min.js +1 -1
  141. package/lib/runtime/components/web/mpx-input.vue +1 -1
  142. package/lib/runtime/components/web/mpx-scroll-view.vue +21 -4
  143. package/lib/runtime/components/web/mpx-sticky-header.vue +91 -0
  144. package/lib/runtime/components/web/mpx-sticky-section.vue +15 -0
  145. package/lib/runtime/stringify.wxs +2 -2
  146. package/lib/template-compiler/compiler.js +8 -8
  147. package/lib/utils/env.js +1 -1
  148. package/package.json +4 -5
  149. package/LICENSE +0 -433
  150. /package/lib/runtime/components/react/dist/{pickerVIewContext.js → mpx-picker-view/pickerVIewContext.js} +0 -0
  151. /package/lib/runtime/components/react/dist/{pickerViewIndicator.jsx → mpx-picker-view-column/pickerViewIndicator.jsx} +0 -0
  152. /package/lib/runtime/components/react/dist/{pickerViewMask.jsx → mpx-picker-view-column/pickerViewMask.jsx} +0 -0
  153. /package/lib/runtime/components/react/{pickerVIewContext.ts → mpx-picker-view/pickerVIewContext.ts} +0 -0
  154. /package/lib/runtime/components/react/{pickerViewIndicator.tsx → mpx-picker-view-column/pickerViewIndicator.tsx} +0 -0
  155. /package/lib/runtime/components/react/{pickerViewMask.tsx → mpx-picker-view-column/pickerViewMask.tsx} +0 -0
@@ -0,0 +1,45 @@
1
+ import { useRef, forwardRef, createElement, useCallback, useMemo } from 'react';
2
+ import { View } from 'react-native';
3
+ import useNodesRef from './useNodesRef';
4
+ import { splitProps, splitStyle, useTransformStyle, wrapChildren, useLayout, extendObject } from './utils';
5
+ import { StickyContext } from './context';
6
+ import useInnerProps from './getInnerListeners';
7
+ const _StickySection = forwardRef((stickySectionProps = {}, ref) => {
8
+ const { textProps, innerProps: props = {} } = splitProps(stickySectionProps);
9
+ const { style, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight } = props;
10
+ const sectionRef = useRef(null);
11
+ const { normalStyle, hasVarDec, varContextRef, hasSelfPercent, setWidth, setHeight } = useTransformStyle(style, { enableVar, externalVarContext, parentFontSize, parentWidth, parentHeight });
12
+ const { layoutRef, layoutProps, layoutStyle } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef: sectionRef, onLayout });
13
+ const { textStyle, innerStyle = {} } = splitStyle(normalStyle);
14
+ const stickyHeaders = useRef(new Map());
15
+ const registerStickyHeader = useCallback((item) => {
16
+ stickyHeaders.current.set(item.id, item);
17
+ }, []);
18
+ const unregisterStickyHeader = useCallback((id) => {
19
+ stickyHeaders.current.delete(id);
20
+ }, []);
21
+ const contextValue = useMemo(() => ({
22
+ registerStickyHeader,
23
+ unregisterStickyHeader
24
+ }), []);
25
+ useNodesRef(props, ref, sectionRef, {
26
+ style: normalStyle
27
+ });
28
+ function onLayout() {
29
+ stickyHeaders.current.forEach(item => {
30
+ item.updatePosition();
31
+ });
32
+ }
33
+ const innerProps = useInnerProps(extendObject({}, props, {
34
+ style: extendObject(innerStyle, layoutStyle),
35
+ ref: sectionRef
36
+ }, layoutProps), [], { layoutRef });
37
+ return (createElement(View, innerProps, createElement(StickyContext.Provider, { value: contextValue }, wrapChildren(props, {
38
+ hasVarDec,
39
+ varContext: varContextRef.current,
40
+ textStyle,
41
+ textProps
42
+ }))));
43
+ });
44
+ _StickySection.displayName = 'MpxStickySection';
45
+ export default _StickySection;
@@ -2,7 +2,7 @@ import Animated, { useAnimatedStyle, interpolate } from 'react-native-reanimated
2
2
  import { forwardRef, useRef, useContext } from 'react';
3
3
  import useInnerProps from './getInnerListeners';
4
4
  import useNodesRef from './useNodesRef'; // 引入辅助函数
5
- import { useTransformStyle, splitStyle, splitProps, wrapChildren, useLayout } from './utils';
5
+ import { useTransformStyle, splitStyle, splitProps, wrapChildren, useLayout, extendObject } from './utils';
6
6
  import { SwiperContext } from './context';
7
7
  const _SwiperItem = forwardRef((props, ref) => {
8
8
  const { 'enable-var': enableVar, 'external-var-context': externalVarContext, style, customStyle, itemIndex } = props;
@@ -21,10 +21,9 @@ const _SwiperItem = forwardRef((props, ref) => {
21
21
  const {
22
22
  // 存储layout布局信息
23
23
  layoutRef, layoutProps, layoutStyle } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef: nodeRef });
24
- const innerProps = useInnerProps(props, {
25
- ref: nodeRef,
26
- ...layoutProps
27
- }, [
24
+ const innerProps = useInnerProps(extendObject({}, props, layoutProps, {
25
+ ref: nodeRef
26
+ }), [
28
27
  'children',
29
28
  'enable-offset',
30
29
  'style'
@@ -4,7 +4,7 @@ import Animated, { useAnimatedStyle, useSharedValue, withTiming, Easing, runOnJS
4
4
  import React, { forwardRef, useRef, useEffect, useMemo } from 'react';
5
5
  import useInnerProps, { getCustomEvent } from './getInnerListeners';
6
6
  import useNodesRef from './useNodesRef'; // 引入辅助函数
7
- import { useTransformStyle, splitStyle, splitProps, useLayout, wrapChildren } from './utils';
7
+ import { useTransformStyle, splitStyle, splitProps, useLayout, wrapChildren, extendObject } from './utils';
8
8
  import { SwiperContext } from './context';
9
9
  /**
10
10
  * 默认的Style类型
@@ -124,9 +124,9 @@ const SwiperWrapper = forwardRef((props, ref) => {
124
124
  const {
125
125
  // 存储layout布局信息
126
126
  layoutRef, layoutProps, layoutStyle } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef, onLayout: onWrapperLayout });
127
- const innerProps = useInnerProps(props, {
127
+ const innerProps = useInnerProps(extendObject({}, props, {
128
128
  ref: nodeRef
129
- }, [
129
+ }), [
130
130
  'style',
131
131
  'indicator-dots',
132
132
  'indicator-color',
@@ -187,8 +187,8 @@ const SwiperWrapper = forwardRef((props, ref) => {
187
187
  dotAnimatedStyle
188
188
  ]}/>
189
189
  {dots}
190
- </View>
191
- </View>);
190
+ </View>
191
+ </View>);
192
192
  }
193
193
  function renderItems() {
194
194
  const intLen = children.length;
@@ -641,12 +641,12 @@ const SwiperWrapper = forwardRef((props, ref) => {
641
641
  function renderSwiper() {
642
642
  const arrPages = renderItems();
643
643
  return (<View style={[normalStyle, layoutStyle, styles.swiper]} {...layoutProps} {...innerProps}>
644
- <Animated.View style={[{
644
+ <Animated.View style={[{
645
645
  flexDirection: dir === 'x' ? 'row' : 'column',
646
646
  width: '100%',
647
647
  height: '100%'
648
648
  }, animatedStyles]}>
649
- {wrapChildren({
649
+ {wrapChildren({
650
650
  children: arrPages
651
651
  }, {
652
652
  hasVarDec,
@@ -654,8 +654,8 @@ const SwiperWrapper = forwardRef((props, ref) => {
654
654
  textStyle,
655
655
  textProps
656
656
  })}
657
- </Animated.View>
658
- {showsPagination && renderPagination()}
657
+ </Animated.View>
658
+ {showsPagination && renderPagination()}
659
659
  </View>);
660
660
  }
661
661
  if (children.length === 1) {
@@ -67,17 +67,15 @@ const _Switch = forwardRef((props, ref) => {
67
67
  }
68
68
  };
69
69
  }, []);
70
- const innerProps = useInnerProps(props, extendObject({
70
+ const innerProps = useInnerProps(extendObject({}, props, layoutProps, {
71
71
  ref: nodeRef,
72
72
  style: extendObject({}, normalStyle, layoutStyle)
73
- }, layoutProps, !disabled ? { [type === 'switch' ? 'onValueChange' : '_onChange']: onChange } : {}), [
73
+ }, !disabled ? { [type === 'switch' ? 'onValueChange' : '_onChange']: onChange } : {}), [
74
74
  'checked',
75
75
  'disabled',
76
76
  'type',
77
77
  'color'
78
- ], {
79
- layoutRef
80
- });
78
+ ], { layoutRef });
81
79
  if (type === 'checkbox') {
82
80
  return createElement(CheckBox, extendObject({}, innerProps, {
83
81
  color: color,
@@ -7,10 +7,9 @@ import { Text } from 'react-native';
7
7
  import { useRef, forwardRef, createElement } from 'react';
8
8
  import useInnerProps from './getInnerListeners';
9
9
  import useNodesRef from './useNodesRef'; // 引入辅助函数
10
- import { useTransformStyle, wrapChildren } from './utils';
10
+ import { useTransformStyle, wrapChildren, extendObject } from './utils';
11
11
  const _Text = forwardRef((props, ref) => {
12
12
  const { style = {}, allowFontScaling = false, selectable, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'user-select': userSelect, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight } = props;
13
- const layoutRef = useRef({});
14
13
  const { normalStyle, hasVarDec, varContextRef } = useTransformStyle(style, {
15
14
  enableVar,
16
15
  externalVarContext,
@@ -22,16 +21,14 @@ const _Text = forwardRef((props, ref) => {
22
21
  useNodesRef(props, ref, nodeRef, {
23
22
  style: normalStyle
24
23
  });
25
- const innerProps = useInnerProps(props, {
24
+ const innerProps = useInnerProps(extendObject({}, props, {
26
25
  ref: nodeRef,
27
26
  style: normalStyle,
28
27
  selectable: !!selectable || !!userSelect,
29
28
  allowFontScaling
30
- }, [
29
+ }), [
31
30
  'user-select'
32
- ], {
33
- layoutRef
34
- });
31
+ ]);
35
32
  return createElement(Text, innerProps, wrapChildren(props, {
36
33
  hasVarDec,
37
34
  varContext: varContextRef.current
@@ -64,7 +64,7 @@
64
64
  */
65
65
  import { useRef, forwardRef, createElement } from 'react';
66
66
  import Video, { DRMType } from 'react-native-video';
67
- import { StyleSheet, View, Platform } from 'react-native';
67
+ import { StyleSheet, View } from 'react-native';
68
68
  import { splitProps, useTransformStyle, useLayout, extendObject } from './utils';
69
69
  import useInnerProps, { getCustomEvent } from './getInnerListeners';
70
70
  import useNodesRef from './useNodesRef';
@@ -132,7 +132,7 @@ const MpxVideo = forwardRef((videoProps, ref) => {
132
132
  // 手动拖拽进度条场景,android 可以触发,ios 不可以
133
133
  bindseekcomplete(getCustomEvent('seekcomplete', {}, {
134
134
  detail: {
135
- position: Platform.OS === 'android' ? seekTime * 1000 : seekTime
135
+ position: __mpx_mode__ !== 'ios' ? seekTime * 1000 : seekTime
136
136
  },
137
137
  layoutRef
138
138
  }, propsRef.current));
@@ -202,11 +202,11 @@ const MpxVideo = forwardRef((videoProps, ref) => {
202
202
  if (isDrm) {
203
203
  source.drm = {
204
204
  type: DRMType.FAIRPLAY,
205
- certificateUrl: Platform.OS === 'android' ? provisionUrl : certificateUrl,
205
+ certificateUrl: __mpx_mode__ !== 'ios' ? provisionUrl : certificateUrl,
206
206
  licenseServer: licenseUrl
207
207
  };
208
208
  }
209
- const innerProps = useInnerProps(props, extendObject({
209
+ const innerProps = useInnerProps(extendObject({}, props, layoutProps, {
210
210
  style: styles.video,
211
211
  ref: videoRef,
212
212
  source,
@@ -228,7 +228,7 @@ const MpxVideo = forwardRef((videoProps, ref) => {
228
228
  onFullscreenPlayerWillDismiss: bindfullscreenchange && handleExitFullScreen,
229
229
  onControlsVisibilityChange: bindcontrolstoggle && handleAndroidControlsVisibilityChange,
230
230
  onLoad: handleVideoLoad
231
- }, layoutProps), [
231
+ }), [
232
232
  'src',
233
233
  'autoplay',
234
234
  'loop',
@@ -11,7 +11,7 @@ import Animated from 'react-native-reanimated';
11
11
  import useAnimationHooks from './useAnimationHooks';
12
12
  import useNodesRef from './useNodesRef';
13
13
  import { parseUrl, PERCENT_REGEX, splitStyle, splitProps, useTransformStyle, wrapChildren, useLayout, renderImage, pickStyle, extendObject, useHover } from './utils';
14
- import { error } from '@mpxjs/utils';
14
+ import { error, isFunction } from '@mpxjs/utils';
15
15
  import LinearGradient from 'react-native-linear-gradient';
16
16
  import { GestureDetector } from 'react-native-gesture-handler';
17
17
  import Portal from './mpx-portal';
@@ -543,7 +543,7 @@ function wrapWithChildren(props, { hasVarDec, enableBackground, textStyle, backg
543
543
  }
544
544
  const _View = forwardRef((viewProps, ref) => {
545
545
  const { textProps, innerProps: props = {} } = splitProps(viewProps);
546
- 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;
546
+ 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, catchtransitionend, bindtransitionend } = props;
547
547
  // 默认样式
548
548
  const defaultStyle = style.display === 'flex'
549
549
  ? {
@@ -575,15 +575,29 @@ const _View = forwardRef((viewProps, ref) => {
575
575
  });
576
576
  const { layoutRef, layoutStyle, layoutProps } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef });
577
577
  const viewStyle = extendObject({}, innerStyle, layoutStyle);
578
- const { enableStyleAnimation, animationStyle } = useAnimationHooks({
579
- enableAnimation,
580
- animation,
581
- style: viewStyle
582
- });
583
- const innerProps = useInnerProps(props, extendObject({
578
+ const transitionend = isFunction(catchtransitionend)
579
+ ? catchtransitionend
580
+ : isFunction(bindtransitionend)
581
+ ? bindtransitionend
582
+ : null;
583
+ const { enableStyleAnimation, animationStyle } = useAnimationHooks(transitionend
584
+ ? {
585
+ layoutRef,
586
+ animation,
587
+ enableAnimation,
588
+ style: viewStyle,
589
+ transitionend
590
+ }
591
+ : {
592
+ layoutRef,
593
+ animation,
594
+ enableAnimation,
595
+ style: viewStyle
596
+ });
597
+ const innerProps = useInnerProps(extendObject({}, props, layoutProps, {
584
598
  ref: nodeRef,
585
599
  style: enableStyleAnimation ? [viewStyle, animationStyle] : viewStyle
586
- }, layoutProps), [
600
+ }), [
587
601
  'hover-start-time',
588
602
  'hover-stay-time',
589
603
  'hover-style',
@@ -1,4 +1,4 @@
1
- import { forwardRef, useRef, useContext, useMemo, useState, useEffect } from 'react';
1
+ import { forwardRef, useRef, useContext, useMemo, useState } from 'react';
2
2
  import { warn, isFunction } from '@mpxjs/utils';
3
3
  import Portal from './mpx-portal/index';
4
4
  import { getCustomEvent } from './getInnerListeners';
@@ -74,14 +74,17 @@ const _WebView = forwardRef((props, ref) => {
74
74
  isNavigateBack.current = false;
75
75
  };
76
76
  const navigation = useNavigation();
77
- useEffect(() => {
78
- const beforeRemoveSubscription = navigation?.addListener?.('beforeRemove', beforeRemoveHandle);
79
- return () => {
80
- if (isFunction(beforeRemoveSubscription)) {
81
- beforeRemoveSubscription();
82
- }
83
- };
84
- }, []);
77
+ // useEffect(() => {
78
+ // let beforeRemoveSubscription:any
79
+ // if (__mpx_mode__ !== 'ios') {
80
+ // beforeRemoveSubscription = navigation?.addListener?.('beforeRemove', beforeRemoveHandle)
81
+ // }
82
+ // return () => {
83
+ // if (isFunction(beforeRemoveSubscription)) {
84
+ // beforeRemoveSubscription()
85
+ // }
86
+ // }
87
+ // }, [])
85
88
  useNodesRef(props, ref, webViewRef, {
86
89
  style: defaultWebViewStyle
87
90
  });
@@ -89,7 +92,7 @@ const _WebView = forwardRef((props, ref) => {
89
92
  return null;
90
93
  }
91
94
  const _reload = function () {
92
- if (__mpx_mode__ === 'android') {
95
+ if (__mpx_mode__ !== 'ios') {
93
96
  fristLoaded.current = false; // 安卓需要重新设置
94
97
  }
95
98
  setPageLoadErr(false);
@@ -133,7 +136,7 @@ const _WebView = forwardRef((props, ref) => {
133
136
  }
134
137
  };
135
138
  const _onLoadProgress = function (event) {
136
- if (__mpx_mode__ === 'android') {
139
+ if (__mpx_mode__ !== 'ios') {
137
140
  canGoBack.current = event.nativeEvent.canGoBack;
138
141
  }
139
142
  };
@@ -157,7 +160,7 @@ const _WebView = forwardRef((props, ref) => {
157
160
  { // case下不允许直接声明,包个块解决该问题
158
161
  const title = postData._documentTitle?.trim();
159
162
  if (title !== undefined) {
160
- navigation && navigation.setOptions({ title });
163
+ navigation && navigation.setPageConfig({ navigationBarTitleText: title });
161
164
  }
162
165
  }
163
166
  break;
@@ -251,7 +254,7 @@ const _WebView = forwardRef((props, ref) => {
251
254
  }
252
255
  };
253
256
  const onLoadEnd = function (res) {
254
- if (__mpx_mode__ === 'android') {
257
+ if (__mpx_mode__ !== 'ios') {
255
258
  res.persist();
256
259
  setTimeout(() => {
257
260
  onLoadEndHandle(res);
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useMemo, useRef } from 'react';
2
- import { Easing, useSharedValue, withTiming, useAnimatedStyle, withSequence, withDelay, makeMutable, cancelAnimation } from 'react-native-reanimated';
3
- import { error, hasOwn } from '@mpxjs/utils';
2
+ import { Easing, useSharedValue, withTiming, useAnimatedStyle, withSequence, withDelay, makeMutable, cancelAnimation, runOnJS } from 'react-native-reanimated';
3
+ import { error, hasOwn, collectDataset } from '@mpxjs/utils';
4
4
  // 微信 timingFunction 和 RN Easing 对应关系
5
5
  const EasingKey = {
6
6
  linear: Easing.linear,
@@ -140,7 +140,7 @@ function getTransformObj(transforms) {
140
140
  }, {});
141
141
  }
142
142
  export default function useAnimationHooks(props) {
143
- const { style = {}, animation, enableAnimation } = props;
143
+ const { style = {}, animation, enableAnimation, transitionend, layoutRef } = props;
144
144
  const enableStyleAnimation = enableAnimation || !!animation;
145
145
  const enableAnimationRef = useRef(enableStyleAnimation);
146
146
  if (enableAnimationRef.current !== enableStyleAnimation) {
@@ -249,10 +249,32 @@ export default function useAnimationHooks(props) {
249
249
  });
250
250
  });
251
251
  }
252
+ function withTimingCallback(finished, current, duration) {
253
+ if (!transitionend)
254
+ return;
255
+ const target = {
256
+ id: animation?.id || -1,
257
+ dataset: collectDataset(props),
258
+ offsetLeft: layoutRef?.current?.offsetLeft || 0,
259
+ offsetTop: layoutRef?.current?.offsetTop || 0
260
+ };
261
+ transitionend({
262
+ type: 'transitionend',
263
+ detail: { elapsedTime: duration, finished, current },
264
+ target,
265
+ currentTarget: target,
266
+ timeStamp: Date.now()
267
+ });
268
+ }
252
269
  // 创建单个animation
253
270
  function getAnimation({ key, value }, { delay, duration, easing }, callback) {
254
271
  const animation = typeof callback === 'function'
255
- ? withTiming(value, { duration, easing }, callback)
272
+ ? withTiming(value, { duration, easing }, (finished, current) => {
273
+ callback(finished, current);
274
+ if (transitionend && finished) {
275
+ runOnJS(withTimingCallback)(finished, current, duration);
276
+ }
277
+ })
256
278
  : withTiming(value, { duration, easing });
257
279
  return delay ? withDelay(delay, animation) : animation;
258
280
  }
@@ -19,6 +19,7 @@ export const HIDDEN_STYLE = {
19
19
  };
20
20
  export const isIOS = __mpx_mode__ === 'ios';
21
21
  export const isAndroid = __mpx_mode__ === 'android';
22
+ export const isHarmony = __mpx_mode__ === 'harmony';
22
23
  const varDecRegExp = /^--/;
23
24
  const varUseRegExp = /var\(/;
24
25
  const unoVarDecRegExp = /^--un-/;
@@ -80,7 +81,7 @@ export function isText(ele) {
80
81
  if (isValidElement(ele)) {
81
82
  const displayName = ele.type?.displayName;
82
83
  const isCustomText = ele.type?.isCustomText;
83
- return displayName === 'MpxText' || displayName === 'MpxSimpleText' || displayName === 'Text' || !!isCustomText;
84
+ return displayName === 'MpxText' || displayName === 'MpxSimpleText' || displayName === 'MpxInlineText' || displayName === 'Text' || !!isCustomText;
84
85
  }
85
86
  return false;
86
87
  }
@@ -450,7 +451,18 @@ export const useLayout = ({ props, hasSelfPercent, setWidth, setHeight, onLayout
450
451
  if (enableOffset) {
451
452
  nodeRef.current?.measure((x, y, width, height, offsetLeft, offsetTop) => {
452
453
  const { y: navigationY = 0 } = navigation?.layout || {};
453
- layoutRef.current = { x, y: y - navigationY, width, height, offsetLeft, offsetTop: offsetTop - navigationY };
454
+ layoutRef.current = {
455
+ x,
456
+ y: y - navigationY,
457
+ width,
458
+ height,
459
+ offsetLeft,
460
+ offsetTop: offsetTop - navigationY,
461
+ _x: x,
462
+ _y: y,
463
+ _offsetLeft: offsetLeft,
464
+ _offsetTop: offsetTop
465
+ };
454
466
  });
455
467
  }
456
468
  onLayout && onLayout(e);
@@ -1,9 +1,3 @@
1
- interface EventConfig {
2
- [key: string]: string[];
3
- }
4
-
5
- export const TAP_EVENTS = ['bindtap', 'catchtap', 'capture-bindtap', 'capture-catchtap']
6
-
7
1
  const eventConfigMap: { [key: string]: { bitFlag: string; events: string[] } } = {
8
2
  bindtap: { bitFlag: '0', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd'] },
9
3
  bindlongpress: { bitFlag: '1', events: ['onTouchStart', 'onTouchMove', 'onTouchEnd', 'onTouchCancel'] },
@@ -30,4 +24,5 @@ const eventConfigMap: { [key: string]: { bitFlag: string; events: string[] } } =
30
24
  'capture-catchtouchend': { bitFlag: 'm', events: ['onTouchEndCapture'] },
31
25
  'capture-catchtouchcancel': { bitFlag: 'n', events: ['onTouchCancelCapture'] }
32
26
  }
27
+
33
28
  export default eventConfigMap