@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
@@ -76,36 +76,36 @@ import useInnerProps, { getCustomEvent } from './getInnerListeners'
76
76
  import useNodesRef, { HandlerRef } from './useNodesRef'
77
77
 
78
78
  interface VideoProps {
79
- src: string;
80
- autoplay?: boolean;
81
- loop?: boolean;
82
- muted?: boolean;
83
- controls?: boolean;
84
- poster?: string;
85
- style?: ViewStyle;
86
- 'initial-time'?: number;
87
- 'object-fit'?: null | 'contain' | 'fill' | 'cover';
88
- 'is-drm'?: boolean;
89
- 'provision-url'?: string;
90
- 'certificate-url'?: string;
91
- 'license-url'?: string;
92
- 'preferred-peak-bit-rate'?: number;
93
- 'enable-auto-rotation'?: number;
94
- 'enable-var'?: boolean;
95
- 'external-var-context'?: Record<string, any>;
96
- 'parent-font-size'?: number;
97
- 'parent-width'?: number;
98
- 'parent-height'?: number;
99
- bindplay?: (event: Record<string, any>) => void;
100
- bindpause?: (event: Record<string, any>) => void;
101
- bindended?: (event: Record<string, any>) => void;
102
- bindtimeupdate?: (event: Record<string, any>) => void;
103
- bindfullscreenchange?: (event: Record<string, any>) => void;
104
- bindwaiting?: (event: Record<string, any>) => void;
105
- binderror?: (event: Record<string, any>) => void;
106
- bindloadedmetadata?: (event: Record<string, any>) => void;
107
- bindcontrolstoggle?: (event: Record<string, any>) => void;
108
- bindseekcomplete?: (event: Record<string, any>) => void;
79
+ src: string
80
+ autoplay?: boolean
81
+ loop?: boolean
82
+ muted?: boolean
83
+ controls?: boolean
84
+ poster?: string
85
+ style?: ViewStyle
86
+ 'initial-time'?: number
87
+ 'object-fit'?: null | 'contain' | 'fill' | 'cover'
88
+ 'is-drm'?: boolean
89
+ 'provision-url'?: string
90
+ 'certificate-url'?: string
91
+ 'license-url'?: string
92
+ 'preferred-peak-bit-rate'?: number
93
+ 'enable-auto-rotation'?: number
94
+ 'enable-var'?: boolean
95
+ 'external-var-context'?: Record<string, any>
96
+ 'parent-font-size'?: number
97
+ 'parent-width'?: number
98
+ 'parent-height'?: number
99
+ bindplay?: (event: Record<string, any>) => void
100
+ bindpause?: (event: Record<string, any>) => void
101
+ bindended?: (event: Record<string, any>) => void
102
+ bindtimeupdate?: (event: Record<string, any>) => void
103
+ bindfullscreenchange?: (event: Record<string, any>) => void
104
+ bindwaiting?: (event: Record<string, any>) => void
105
+ binderror?: (event: Record<string, any>) => void
106
+ bindloadedmetadata?: (event: Record<string, any>) => void
107
+ bindcontrolstoggle?: (event: Record<string, any>) => void
108
+ bindseekcomplete?: (event: Record<string, any>) => void
109
109
  }
110
110
  interface VideoInfoData {
111
111
  naturalSize: {
@@ -233,7 +233,7 @@ const MpxVideo = forwardRef<HandlerRef<View, VideoProps>, VideoProps>((videoProp
233
233
  {},
234
234
  {
235
235
  detail: {
236
- position: Platform.OS === 'android' ? seekTime * 1000 : seekTime
236
+ position: __mpx_mode__ !== 'ios' ? seekTime * 1000 : seekTime
237
237
  },
238
238
  layoutRef
239
239
  },
@@ -326,14 +326,16 @@ const MpxVideo = forwardRef<HandlerRef<View, VideoProps>, VideoProps>((videoProp
326
326
  if (isDrm) {
327
327
  source.drm = {
328
328
  type: DRMType.FAIRPLAY,
329
- certificateUrl: Platform.OS === 'android' ? provisionUrl : certificateUrl,
329
+ certificateUrl: __mpx_mode__ !== 'ios' ? provisionUrl : certificateUrl,
330
330
  licenseServer: licenseUrl
331
331
  }
332
332
  }
333
333
 
334
334
  const innerProps = useInnerProps(
335
- props,
336
335
  extendObject(
336
+ {},
337
+ props,
338
+ layoutProps,
337
339
  {
338
340
  style: styles.video,
339
341
  ref: videoRef,
@@ -360,8 +362,7 @@ const MpxVideo = forwardRef<HandlerRef<View, VideoProps>, VideoProps>((videoProp
360
362
  onControlsVisibilityChange:
361
363
  bindcontrolstoggle && handleAndroidControlsVisibilityChange,
362
364
  onLoad: handleVideoLoad
363
- },
364
- layoutProps
365
+ }
365
366
  ),
366
367
  [
367
368
  'src',
@@ -13,7 +13,7 @@ import type { AnimationProp } from './useAnimationHooks'
13
13
  import { ExtendedViewStyle } from './types/common'
14
14
  import useNodesRef, { HandlerRef } from './useNodesRef'
15
15
  import { parseUrl, PERCENT_REGEX, splitStyle, splitProps, useTransformStyle, wrapChildren, useLayout, renderImage, pickStyle, extendObject, useHover } from './utils'
16
- import { error } from '@mpxjs/utils'
16
+ import { error, isFunction } from '@mpxjs/utils'
17
17
  import LinearGradient from 'react-native-linear-gradient'
18
18
  import { GestureDetector, PanGesture } from 'react-native-gesture-handler'
19
19
  import Portal from './mpx-portal'
@@ -36,6 +36,8 @@ export interface _ViewProps extends ViewProps {
36
36
  bindtouchstart?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void
37
37
  bindtouchmove?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void
38
38
  bindtouchend?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void
39
+ bindtransitionend?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void
40
+ catchtransitionend?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void
39
41
  }
40
42
 
41
43
  type Handler = (...args: any[]) => void
@@ -683,7 +685,9 @@ const _View = forwardRef<HandlerRef<View, _ViewProps>, _ViewProps>((viewProps, r
683
685
  'parent-font-size': parentFontSize,
684
686
  'parent-width': parentWidth,
685
687
  'parent-height': parentHeight,
686
- animation
688
+ animation,
689
+ catchtransitionend,
690
+ bindtransitionend
687
691
  } = props
688
692
 
689
693
  // 默认样式
@@ -737,28 +741,48 @@ const _View = forwardRef<HandlerRef<View, _ViewProps>, _ViewProps>((viewProps, r
737
741
  } = useLayout({ props, hasSelfPercent, setWidth, setHeight, nodeRef })
738
742
 
739
743
  const viewStyle = extendObject({}, innerStyle, layoutStyle)
740
-
741
- const { enableStyleAnimation, animationStyle } = useAnimationHooks({
742
- enableAnimation,
743
- animation,
744
- style: viewStyle
745
- })
744
+ const transitionend = isFunction(catchtransitionend)
745
+ ? catchtransitionend
746
+ : isFunction(bindtransitionend)
747
+ ? bindtransitionend
748
+ : null
749
+ const { enableStyleAnimation, animationStyle } = useAnimationHooks(
750
+ transitionend
751
+ ? {
752
+ layoutRef,
753
+ animation,
754
+ enableAnimation,
755
+ style: viewStyle,
756
+ transitionend
757
+ }
758
+ : {
759
+ layoutRef,
760
+ animation,
761
+ enableAnimation,
762
+ style: viewStyle
763
+ })
746
764
 
747
765
  const innerProps = useInnerProps(
748
- props,
749
- extendObject({
750
- ref: nodeRef,
751
- style: enableStyleAnimation ? [viewStyle, animationStyle] : viewStyle
752
- },
753
- layoutProps
754
- ), [
766
+ extendObject(
767
+ {},
768
+ props,
769
+ layoutProps,
770
+ {
771
+ ref: nodeRef,
772
+ style: enableStyleAnimation ? [viewStyle, animationStyle] : viewStyle
773
+ }
774
+
775
+ ),
776
+ [
755
777
  'hover-start-time',
756
778
  'hover-stay-time',
757
779
  'hover-style',
758
780
  'hover-class'
759
- ], {
781
+ ],
782
+ {
760
783
  layoutRef
761
- })
784
+ }
785
+ )
762
786
 
763
787
  const childNode = wrapWithChildren(props, {
764
788
  hasVarDec,
@@ -122,14 +122,17 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
122
122
 
123
123
  const navigation = useNavigation()
124
124
 
125
- useEffect(() => {
126
- const beforeRemoveSubscription = navigation?.addListener?.('beforeRemove', beforeRemoveHandle)
127
- return () => {
128
- if (isFunction(beforeRemoveSubscription)) {
129
- beforeRemoveSubscription()
130
- }
131
- }
132
- }, [])
125
+ // useEffect(() => {
126
+ // let beforeRemoveSubscription:any
127
+ // if (__mpx_mode__ !== 'ios') {
128
+ // beforeRemoveSubscription = navigation?.addListener?.('beforeRemove', beforeRemoveHandle)
129
+ // }
130
+ // return () => {
131
+ // if (isFunction(beforeRemoveSubscription)) {
132
+ // beforeRemoveSubscription()
133
+ // }
134
+ // }
135
+ // }, [])
133
136
 
134
137
  useNodesRef<WebView, WebViewProps>(props, ref, webViewRef, {
135
138
  style: defaultWebViewStyle
@@ -140,7 +143,7 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
140
143
  }
141
144
 
142
145
  const _reload = function () {
143
- if (__mpx_mode__ === 'android') {
146
+ if (__mpx_mode__ !== 'ios') {
144
147
  fristLoaded.current = false // 安卓需要重新设置
145
148
  }
146
149
  setPageLoadErr(false)
@@ -186,7 +189,7 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
186
189
  }
187
190
 
188
191
  const _onLoadProgress = function (event: WebViewProgressEvent) {
189
- if (__mpx_mode__ === 'android') {
192
+ if (__mpx_mode__ !== 'ios') {
190
193
  canGoBack.current = event.nativeEvent.canGoBack
191
194
  }
192
195
  }
@@ -209,7 +212,7 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
209
212
  { // case下不允许直接声明,包个块解决该问题
210
213
  const title = postData._documentTitle?.trim()
211
214
  if (title !== undefined) {
212
- navigation && navigation.setOptions({ title })
215
+ navigation && navigation.setPageConfig({ navigationBarTitleText: title })
213
216
  }
214
217
  }
215
218
  break
@@ -302,7 +305,7 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
302
305
  }
303
306
  }
304
307
  const onLoadEnd = function (res: WebViewEvent) {
305
- if (__mpx_mode__ === 'android') {
308
+ if (__mpx_mode__ !== 'ios') {
306
309
  res.persist()
307
310
  setTimeout(() => {
308
311
  onLoadEndHandle(res)
@@ -1,57 +1,87 @@
1
- import { MutableRefObject } from 'react'
1
+ import { RefObject, MutableRefObject } from 'react'
2
2
  import { NativeSyntheticEvent } from 'react-native'
3
3
 
4
- type LayoutRef = MutableRefObject<any>
4
+ type LayoutRef = MutableRefObject<{
5
+ x?: number
6
+ y?: number
7
+ width?: number
8
+ height?: number
9
+ offsetLeft?: number
10
+ offsetTop?: number
11
+ } | null>
5
12
 
6
- type SetTimeoutReturnType = ReturnType<typeof setTimeout>
13
+ type InnerRef = MutableRefObject<{
14
+ startTimer: {
15
+ bubble: ReturnType<typeof setTimeout> | null
16
+ capture: ReturnType<typeof setTimeout> | null
17
+ }
18
+ mpxPressInfo: {
19
+ detail: {
20
+ x: number
21
+ y: number
22
+ }
23
+ }
24
+ }>
25
+
26
+ type PropsRef = MutableRefObject<Props>
27
+
28
+ type EventType = 'bubble' | 'capture'
7
29
 
8
30
  type Props = Record<string, any>
9
31
 
10
- type AdditionalProps = Record<string, any>;
32
+ type AdditionalProps = Record<string, any>
11
33
 
12
- type RemoveProps = string[];
34
+ type RemoveProps = string[]
13
35
 
14
36
  type NativeTouchEvent = NativeSyntheticEvent<NativeEvent>
15
37
 
16
38
  type Navigation = Record<string, any> | undefined
17
39
 
40
+ interface EventConfigDetail {
41
+ bubble: string[],
42
+ capture: string[],
43
+ hasCatch: boolean
44
+ }
45
+
46
+ type EventConfig = {
47
+ innerRef: InnerRef
48
+ propsRef: PropsRef
49
+ disableTap: boolean
50
+ layoutRef: LayoutRef
51
+ navigation: Navigation
52
+ [index: string]: EventConfigDetail
53
+ }
54
+
55
+ interface RawConfig {
56
+ layoutRef?: LayoutRef
57
+ disableTap?: boolean
58
+ [index: string]: any
59
+ }
60
+
18
61
  interface NativeEvent {
19
- timestamp: number;
20
- pageX: number;
21
- pageY: number;
62
+ timestamp: number
63
+ pageX: number
64
+ pageY: number
22
65
  touches: TouchPoint[]
23
66
  changedTouches: TouchPoint[]
24
67
  }
25
68
 
26
69
  interface TouchPoint {
27
- identifier: number;
28
- pageX: number;
29
- pageY: number;
30
- clientX: number;
31
- clientY: number;
32
- locationX?: number;
33
- locationY?: number;
70
+ identifier: number
71
+ pageX: number
72
+ pageY: number
73
+ clientX: number
74
+ clientY: number
75
+ locationX?: number
76
+ locationY?: number
34
77
  }
35
78
 
36
- interface InnerRef {
37
- startTimer: {
38
- bubble: null | ReturnType<typeof setTimeout>;
39
- capture: null | ReturnType<typeof setTimeout>;
40
- };
41
- mpxPressInfo: {
42
- detail: {
43
- x: number;
44
- y: number;
45
- };
46
- };
47
- }
48
- interface UseInnerPropsConfig {
49
- layoutRef?: LayoutRef;
50
- disableTouch?: boolean;
51
- disableTap?: boolean
52
- }
53
79
  interface DataSetType {
54
- [key: string]: string;
80
+ [key: string]: string
81
+ }
82
+
83
+ interface ExtendedNativeTouchEvent extends NativeTouchEvent {
84
+ _stoppedEventTypes?: Set<string>
55
85
  }
56
86
 
57
87
  export {
@@ -62,7 +92,11 @@ export {
62
92
  UseInnerPropsConfig,
63
93
  InnerRef,
64
94
  LayoutRef,
65
- SetTimeoutReturnType,
95
+ PropsRef,
66
96
  DataSetType,
67
- Navigation
97
+ Navigation,
98
+ ExtendedNativeTouchEvent,
99
+ EventConfig,
100
+ RawConfig,
101
+ EventType
68
102
  }
@@ -1,4 +1,4 @@
1
- declare let __mpx_mode__: 'wx' | 'ali' | 'swan' | 'qq' | 'tt' | 'web' | 'dd' | 'qa' | 'jd' | 'android' | 'ios'
1
+ declare let __mpx_mode__: 'wx' | 'ali' | 'swan' | 'qq' | 'tt' | 'web' | 'dd' | 'qa' | 'jd' | 'android' | 'ios' | 'harmony'
2
2
  declare module '@mpxjs/utils' {
3
3
  export function isEmptyObject (obj: Object): boolean
4
4
  export function isFunction (fn: unknown): boolean
@@ -1,5 +1,6 @@
1
1
  import { useEffect, useMemo, useRef } from 'react'
2
- import { TransformsStyle } from 'react-native'
2
+ import type { MutableRefObject } from 'react'
3
+ import type { NativeSyntheticEvent, TransformsStyle } from 'react-native'
3
4
  import {
4
5
  Easing,
5
6
  useSharedValue,
@@ -9,11 +10,10 @@ import {
9
10
  withDelay,
10
11
  makeMutable,
11
12
  cancelAnimation,
12
- SharedValue,
13
- WithTimingConfig,
14
- AnimationCallback
13
+ runOnJS
15
14
  } from 'react-native-reanimated'
16
- import { error, hasOwn } from '@mpxjs/utils'
15
+ import type { AnimationCallback, WithTimingConfig, SharedValue, AnimatableValue } from 'react-native-reanimated'
16
+ import { error, hasOwn, collectDataset } from '@mpxjs/utils'
17
17
  import { ExtendedViewStyle } from './types/common'
18
18
  import type { _ViewProps } from './mpx-view'
19
19
 
@@ -175,9 +175,8 @@ function getTransformObj (transforms: { [propName: string]: string | number }[])
175
175
  }, {} as { [propName: string]: string | number })
176
176
  }
177
177
 
178
- export default function useAnimationHooks<T, P> (props: _ViewProps & { enableAnimation?: boolean }) {
179
- const { style = {}, animation, enableAnimation } = props
180
-
178
+ export default function useAnimationHooks<T, P> (props: _ViewProps & { enableAnimation?: boolean, layoutRef: MutableRefObject<any>, transitionend?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void }) {
179
+ const { style = {}, animation, enableAnimation, transitionend, layoutRef } = props
181
180
  const enableStyleAnimation = enableAnimation || !!animation
182
181
  const enableAnimationRef = useRef(enableStyleAnimation)
183
182
  if (enableAnimationRef.current !== enableStyleAnimation) {
@@ -285,10 +284,31 @@ export default function useAnimationHooks<T, P> (props: _ViewProps & { enableAni
285
284
  })
286
285
  })
287
286
  }
287
+ function withTimingCallback (finished?: boolean, current?: AnimatableValue, duration?: number) {
288
+ if (!transitionend) return
289
+ const target = {
290
+ id: animation?.id || -1,
291
+ dataset: collectDataset(props),
292
+ offsetLeft: layoutRef?.current?.offsetLeft || 0,
293
+ offsetTop: layoutRef?.current?.offsetTop || 0
294
+ }
295
+ transitionend({
296
+ type: 'transitionend',
297
+ detail: { elapsedTime: duration, finished, current },
298
+ target,
299
+ currentTarget: target,
300
+ timeStamp: Date.now()
301
+ })
302
+ }
288
303
  // 创建单个animation
289
304
  function getAnimation ({ key, value }: { key: string, value: string|number }, { delay, duration, easing }: ExtendWithTimingConfig, callback?: AnimationCallback) {
290
305
  const animation = typeof callback === 'function'
291
- ? withTiming(value, { duration, easing }, callback)
306
+ ? withTiming(value, { duration, easing }, (finished, current) => {
307
+ callback(finished, current)
308
+ if (transitionend && finished) {
309
+ runOnJS(withTimingCallback)(finished, current, duration)
310
+ }
311
+ })
292
312
  : withTiming(value, { duration, easing })
293
313
  return delay ? withDelay(delay, animation) : animation
294
314
  }
@@ -20,10 +20,11 @@ export const HIDDEN_STYLE = {
20
20
  opacity: 0
21
21
  }
22
22
 
23
- declare const __mpx_mode__: 'ios' | 'android'
23
+ declare const __mpx_mode__: 'ios' | 'android' | 'harmony'
24
24
 
25
25
  export const isIOS = __mpx_mode__ === 'ios'
26
26
  export const isAndroid = __mpx_mode__ === 'android'
27
+ export const isHarmony = __mpx_mode__ === 'harmony'
27
28
 
28
29
  const varDecRegExp = /^--/
29
30
  const varUseRegExp = /var\(/
@@ -98,7 +99,7 @@ export function isText (ele: ReactNode): ele is ReactElement {
98
99
  if (isValidElement(ele)) {
99
100
  const displayName = (ele.type as ExtendedFunctionComponent)?.displayName
100
101
  const isCustomText = (ele.type as ExtendedFunctionComponent)?.isCustomText
101
- return displayName === 'MpxText' || displayName === 'MpxSimpleText' || displayName === 'Text' || !!isCustomText
102
+ return displayName === 'MpxText' || displayName === 'MpxSimpleText' || displayName === 'MpxInlineText' || displayName === 'Text' || !!isCustomText
102
103
  }
103
104
  return false
104
105
  }
@@ -532,7 +533,18 @@ export const useLayout = ({ props, hasSelfPercent, setWidth, setHeight, onLayout
532
533
  if (enableOffset) {
533
534
  nodeRef.current?.measure((x: number, y: number, width: number, height: number, offsetLeft: number, offsetTop: number) => {
534
535
  const { y: navigationY = 0 } = navigation?.layout || {}
535
- layoutRef.current = { x, y: y - navigationY, width, height, offsetLeft, offsetTop: offsetTop - navigationY }
536
+ layoutRef.current = {
537
+ x,
538
+ y: y - navigationY,
539
+ width,
540
+ height,
541
+ offsetLeft,
542
+ offsetTop: offsetTop - navigationY,
543
+ _x: x,
544
+ _y: y,
545
+ _offsetLeft: offsetLeft,
546
+ _offsetTop: offsetTop
547
+ }
536
548
  })
537
549
  }
538
550
  onLayout && onLayout(e)