@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.
- package/lib/config.js +2 -1
- package/lib/index.js +1 -1
- package/lib/platform/json/wx/index.js +6 -4
- package/lib/platform/style/wx/index.js +42 -30
- package/lib/platform/template/wx/component-config/button.js +20 -3
- package/lib/platform/template/wx/component-config/canvas.js +4 -0
- package/lib/platform/template/wx/component-config/checkbox-group.js +4 -0
- package/lib/platform/template/wx/component-config/checkbox.js +4 -0
- package/lib/platform/template/wx/component-config/cover-image.js +7 -1
- package/lib/platform/template/wx/component-config/cover-view.js +4 -0
- package/lib/platform/template/wx/component-config/fix-component-name.js +3 -2
- package/lib/platform/template/wx/component-config/form.js +7 -1
- package/lib/platform/template/wx/component-config/icon.js +4 -0
- package/lib/platform/template/wx/component-config/image.js +7 -1
- package/lib/platform/template/wx/component-config/index.js +5 -1
- package/lib/platform/template/wx/component-config/input.js +19 -4
- package/lib/platform/template/wx/component-config/label.js +4 -0
- package/lib/platform/template/wx/component-config/movable-area.js +7 -1
- package/lib/platform/template/wx/component-config/movable-view.js +12 -3
- package/lib/platform/template/wx/component-config/navigator.js +4 -0
- package/lib/platform/template/wx/component-config/picker-view-column.js +4 -0
- package/lib/platform/template/wx/component-config/picker-view.js +7 -1
- package/lib/platform/template/wx/component-config/picker.js +7 -1
- package/lib/platform/template/wx/component-config/radio-group.js +4 -0
- package/lib/platform/template/wx/component-config/radio.js +4 -0
- package/lib/platform/template/wx/component-config/rich-text.js +4 -0
- package/lib/platform/template/wx/component-config/root-portal.js +4 -0
- package/lib/platform/template/wx/component-config/scroll-view.js +10 -2
- package/lib/platform/template/wx/component-config/sticky-header.js +23 -0
- package/lib/platform/template/wx/component-config/sticky-section.js +23 -0
- package/lib/platform/template/wx/component-config/swiper-item.js +7 -1
- package/lib/platform/template/wx/component-config/swiper.js +12 -3
- package/lib/platform/template/wx/component-config/switch.js +4 -0
- package/lib/platform/template/wx/component-config/text.js +24 -3
- package/lib/platform/template/wx/component-config/textarea.js +17 -2
- package/lib/platform/template/wx/component-config/unsupported.js +7 -0
- package/lib/platform/template/wx/component-config/video.js +10 -2
- package/lib/platform/template/wx/component-config/view.js +11 -1
- package/lib/platform/template/wx/component-config/web-view.js +4 -0
- package/lib/platform/template/wx/index.js +42 -75
- package/lib/react/processJSON.js +7 -6
- package/lib/react/processScript.js +1 -18
- package/lib/runtime/components/react/context.ts +12 -3
- package/lib/runtime/components/react/dist/context.js +4 -1
- package/lib/runtime/components/react/dist/event.config.js +0 -1
- package/lib/runtime/components/react/dist/getInnerListeners.js +127 -142
- package/lib/runtime/components/react/dist/mpx-button.jsx +4 -5
- package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +4 -5
- package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-checkbox.jsx +2 -3
- package/lib/runtime/components/react/dist/mpx-form.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-icon/index.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-image.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-inline-text.jsx +11 -0
- package/lib/runtime/components/react/dist/mpx-input.jsx +20 -17
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +24 -31
- package/lib/runtime/components/react/dist/mpx-label.jsx +2 -3
- package/lib/runtime/components/react/dist/mpx-movable-area.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-movable-view.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-navigator.jsx +11 -3
- package/lib/runtime/components/react/dist/mpx-picker/date.jsx +194 -68
- package/lib/runtime/components/react/dist/mpx-picker/dateData.js +17 -0
- package/lib/runtime/components/react/dist/mpx-picker/index.jsx +180 -98
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.jsx +79 -139
- package/lib/runtime/components/react/dist/mpx-picker/region.jsx +190 -90
- package/lib/runtime/components/react/dist/mpx-picker/selector.jsx +60 -75
- package/lib/runtime/components/react/dist/mpx-picker/time.jsx +100 -228
- package/lib/runtime/components/react/dist/{mpx-picker-view.jsx → mpx-picker-view/index.jsx} +5 -6
- package/lib/runtime/components/react/dist/{mpx-picker-view-column.jsx → mpx-picker-view-column/index.jsx} +64 -16
- package/lib/runtime/components/react/dist/{mpx-picker-view-column-item.jsx → mpx-picker-view-column/pickerViewColumnItem.jsx} +8 -5
- package/lib/runtime/components/react/dist/{pickerFaces.js → mpx-picker-view-column/pickerViewFaces.js} +6 -0
- package/lib/runtime/components/react/dist/mpx-popup/index.jsx +61 -0
- package/lib/runtime/components/react/dist/mpx-popup/popupBase.jsx +92 -0
- package/lib/runtime/components/react/dist/mpx-radio-group.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-radio.jsx +2 -3
- package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +2 -2
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +207 -29
- package/lib/runtime/components/react/dist/mpx-simple-text.jsx +7 -5
- package/lib/runtime/components/react/dist/mpx-simple-view.jsx +11 -15
- package/lib/runtime/components/react/dist/mpx-sticky-header.jsx +115 -0
- package/lib/runtime/components/react/dist/mpx-sticky-section.jsx +45 -0
- package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +4 -5
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +9 -9
- package/lib/runtime/components/react/dist/mpx-switch.jsx +3 -5
- package/lib/runtime/components/react/dist/mpx-text.jsx +4 -7
- package/lib/runtime/components/react/dist/mpx-video.jsx +5 -5
- package/lib/runtime/components/react/dist/mpx-view.jsx +23 -9
- package/lib/runtime/components/react/dist/mpx-web-view.jsx +16 -13
- package/lib/runtime/components/react/dist/useAnimationHooks.js +26 -4
- package/lib/runtime/components/react/dist/utils.jsx +14 -2
- package/lib/runtime/components/react/event.config.ts +1 -6
- package/lib/runtime/components/react/getInnerListeners.ts +148 -191
- package/lib/runtime/components/react/mpx-button.tsx +7 -7
- package/lib/runtime/components/react/mpx-canvas/index.tsx +25 -17
- package/lib/runtime/components/react/mpx-checkbox-group.tsx +4 -3
- package/lib/runtime/components/react/mpx-checkbox.tsx +8 -9
- package/lib/runtime/components/react/mpx-form.tsx +25 -19
- package/lib/runtime/components/react/mpx-icon/index.tsx +4 -3
- package/lib/runtime/components/react/mpx-image.tsx +4 -3
- package/lib/runtime/components/react/mpx-inline-text.tsx +18 -0
- package/lib/runtime/components/react/mpx-input.tsx +24 -21
- package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +31 -42
- package/lib/runtime/components/react/mpx-label.tsx +4 -5
- package/lib/runtime/components/react/mpx-movable-area.tsx +22 -13
- package/lib/runtime/components/react/mpx-movable-view.tsx +47 -40
- package/lib/runtime/components/react/mpx-navigator.tsx +4 -6
- package/lib/runtime/components/react/mpx-picker/date.tsx +226 -69
- package/lib/runtime/components/react/mpx-picker/dateData.ts +22 -0
- package/lib/runtime/components/react/mpx-picker/index.tsx +242 -118
- package/lib/runtime/components/react/mpx-picker/multiSelector.tsx +96 -139
- package/lib/runtime/components/react/mpx-picker/region.tsx +217 -89
- package/lib/runtime/components/react/mpx-picker/selector.tsx +75 -80
- package/lib/runtime/components/react/mpx-picker/time.tsx +119 -236
- package/lib/runtime/components/react/mpx-picker/type.ts +85 -71
- package/lib/runtime/components/react/{mpx-picker-view.tsx → mpx-picker-view/index.tsx} +24 -21
- package/lib/runtime/components/react/{mpx-picker-view-column.tsx → mpx-picker-view-column/index.tsx} +70 -19
- package/lib/runtime/components/react/{mpx-picker-view-column-item.tsx → mpx-picker-view-column/pickerViewColumnItem.tsx} +8 -5
- package/lib/runtime/components/react/{pickerFaces.ts → mpx-picker-view-column/pickerViewFaces.ts} +7 -0
- package/lib/runtime/components/react/mpx-popup/index.tsx +86 -0
- package/lib/runtime/components/react/mpx-popup/popupBase.tsx +130 -0
- package/lib/runtime/components/react/mpx-radio-group.tsx +4 -3
- package/lib/runtime/components/react/mpx-radio.tsx +8 -9
- package/lib/runtime/components/react/mpx-rich-text/index.tsx +15 -6
- package/lib/runtime/components/react/mpx-scroll-view.tsx +326 -96
- package/lib/runtime/components/react/mpx-simple-text.tsx +17 -8
- package/lib/runtime/components/react/mpx-simple-view.tsx +17 -16
- package/lib/runtime/components/react/mpx-sticky-header.tsx +179 -0
- package/lib/runtime/components/react/mpx-sticky-section.tsx +96 -0
- package/lib/runtime/components/react/mpx-swiper-item.tsx +31 -24
- package/lib/runtime/components/react/mpx-swiper.tsx +67 -61
- package/lib/runtime/components/react/mpx-switch.tsx +19 -14
- package/lib/runtime/components/react/mpx-text.tsx +16 -13
- package/lib/runtime/components/react/mpx-video.tsx +36 -35
- package/lib/runtime/components/react/mpx-view.tsx +41 -17
- package/lib/runtime/components/react/mpx-web-view.tsx +15 -12
- package/lib/runtime/components/react/types/getInnerListeners.d.ts +69 -35
- package/lib/runtime/components/react/types/global.d.ts +1 -1
- package/lib/runtime/components/react/useAnimationHooks.ts +29 -9
- package/lib/runtime/components/react/utils.tsx +15 -3
- package/lib/runtime/components/web/mini-video-controls.min.js +1 -1
- package/lib/runtime/components/web/mpx-input.vue +1 -1
- package/lib/runtime/components/web/mpx-scroll-view.vue +21 -4
- package/lib/runtime/components/web/mpx-sticky-header.vue +91 -0
- package/lib/runtime/components/web/mpx-sticky-section.vue +15 -0
- package/lib/runtime/stringify.wxs +2 -2
- package/lib/template-compiler/compiler.js +8 -8
- package/lib/utils/env.js +1 -1
- package/package.json +4 -5
- package/LICENSE +0 -433
- /package/lib/runtime/components/react/dist/{pickerVIewContext.js → mpx-picker-view/pickerVIewContext.js} +0 -0
- /package/lib/runtime/components/react/dist/{pickerViewIndicator.jsx → mpx-picker-view-column/pickerViewIndicator.jsx} +0 -0
- /package/lib/runtime/components/react/dist/{pickerViewMask.jsx → mpx-picker-view-column/pickerViewMask.jsx} +0 -0
- /package/lib/runtime/components/react/{pickerVIewContext.ts → mpx-picker-view/pickerVIewContext.ts} +0 -0
- /package/lib/runtime/components/react/{pickerViewIndicator.tsx → mpx-picker-view-column/pickerViewIndicator.tsx} +0 -0
- /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:
|
|
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:
|
|
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
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
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
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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__
|
|
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__
|
|
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.
|
|
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__
|
|
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<
|
|
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
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
13
|
-
WithTimingConfig,
|
|
14
|
-
AnimationCallback
|
|
13
|
+
runOnJS
|
|
15
14
|
} from 'react-native-reanimated'
|
|
16
|
-
import {
|
|
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 },
|
|
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 = {
|
|
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)
|