@mpxjs/webpack-plugin 2.10.14-beta.2 → 2.10.14-beta.20
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/dependencies/ImportDependency.js +102 -0
- package/lib/index.js +17 -10
- package/lib/platform/style/wx/index.js +7 -1
- package/lib/platform/template/wx/component-config/button.js +13 -4
- package/lib/platform/template/wx/component-config/index.js +3 -1
- package/lib/platform/template/wx/component-config/nav-container.js +27 -0
- package/lib/runtime/components/ali/mpx-nav-container.mpx +3 -0
- package/lib/runtime/components/react/context.ts +18 -6
- package/lib/runtime/components/react/dist/context.d.ts +79 -0
- package/lib/runtime/components/react/dist/context.js +1 -0
- package/lib/runtime/components/react/dist/event.config.d.ts +7 -0
- package/lib/runtime/components/react/dist/getInnerListeners.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts +12 -0
- package/lib/runtime/components/react/dist/mpx-button.d.ts +68 -0
- package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts +23 -0
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts +20 -0
- package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts +8 -0
- package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts +10 -0
- package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts +2 -0
- package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts +32 -0
- package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts +52 -0
- package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts +20 -0
- package/lib/runtime/components/react/dist/mpx-checkbox.d.ts +32 -0
- package/lib/runtime/components/react/dist/mpx-form.d.ts +27 -0
- package/lib/runtime/components/react/dist/mpx-icon/index.d.ts +18 -0
- package/lib/runtime/components/react/dist/mpx-image.d.ts +21 -0
- package/lib/runtime/components/react/dist/mpx-inline-text.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-input.d.ts +50 -0
- package/lib/runtime/components/react/dist/mpx-input.jsx +38 -19
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts +12 -0
- package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +81 -48
- package/lib/runtime/components/react/dist/mpx-label.d.ts +20 -0
- package/lib/runtime/components/react/dist/mpx-movable-area.d.ts +20 -0
- package/lib/runtime/components/react/dist/mpx-movable-view.d.ts +63 -0
- package/lib/runtime/components/react/dist/mpx-nav-container.d.ts +9 -0
- package/lib/runtime/components/react/dist/mpx-nav-container.jsx +23 -0
- package/lib/runtime/components/react/dist/mpx-navigator.d.ts +9 -0
- package/lib/runtime/components/react/dist/mpx-picker/date.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-picker/index.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/region.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts +2 -0
- package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/time.d.ts +6 -0
- package/lib/runtime/components/react/dist/mpx-picker/type.d.ts +106 -0
- package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts +31 -0
- package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts +8 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts +22 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts +14 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts +16 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts +12 -0
- package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts +11 -0
- package/lib/runtime/components/react/dist/mpx-popup/index.d.ts +22 -0
- package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts +16 -0
- package/lib/runtime/components/react/dist/mpx-portal/index.d.ts +15 -0
- package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts +29 -0
- package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts +9 -0
- package/lib/runtime/components/react/dist/mpx-radio-group.d.ts +20 -0
- package/lib/runtime/components/react/dist/mpx-radio.d.ts +26 -0
- package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts +1 -0
- package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts +24 -0
- package/lib/runtime/components/react/dist/mpx-root-portal.d.ts +14 -0
- package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts +54 -0
- package/lib/runtime/components/react/dist/mpx-simple-text.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-simple-view.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts +17 -0
- package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts +15 -0
- package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts +18 -0
- package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +1 -1
- package/lib/runtime/components/react/dist/mpx-swiper.d.ts +54 -0
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +49 -5
- package/lib/runtime/components/react/dist/mpx-switch.d.ts +26 -0
- package/lib/runtime/components/react/dist/mpx-text.d.ts +21 -0
- package/lib/runtime/components/react/dist/mpx-textarea.d.ts +7 -0
- package/lib/runtime/components/react/dist/mpx-textarea.jsx +1 -0
- package/lib/runtime/components/react/dist/mpx-video.d.ts +101 -0
- package/lib/runtime/components/react/dist/mpx-view.d.ts +34 -0
- package/lib/runtime/components/react/dist/mpx-view.jsx +3 -2
- package/lib/runtime/components/react/dist/mpx-web-view.d.ts +22 -0
- package/lib/runtime/components/react/dist/nav.d.ts +8 -0
- package/lib/runtime/components/react/dist/nav.jsx +138 -0
- package/lib/runtime/components/react/dist/parser.d.ts +39 -0
- package/lib/runtime/components/react/dist/useAnimationHooks.d.ts +32 -0
- package/lib/runtime/components/react/dist/useNavShared.d.ts +2 -0
- package/lib/runtime/components/react/dist/useNavShared.js +6 -0
- package/lib/runtime/components/react/dist/useNodesRef.d.ts +11 -0
- package/lib/runtime/components/react/dist/utils.d.ts +122 -0
- package/lib/runtime/components/react/mpx-input.tsx +48 -26
- package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +91 -47
- package/lib/runtime/components/react/mpx-nav-container.tsx +33 -0
- package/lib/runtime/components/react/mpx-swiper-item.tsx +1 -1
- package/lib/runtime/components/react/mpx-swiper.tsx +60 -7
- package/lib/runtime/components/react/mpx-textarea.tsx +1 -0
- package/lib/runtime/components/react/mpx-view.tsx +3 -2
- package/lib/runtime/components/react/nav.tsx +164 -0
- package/lib/runtime/components/react/types/common.d.ts +19 -0
- package/lib/runtime/components/react/useNavShared.ts +8 -0
- package/lib/runtime/components/web/mpx-nav-container.vue +13 -0
- package/lib/runtime/components/wx/mpx-nav-container.mpx +9 -0
- package/lib/utils/dom-tag-config.js +2 -2
- package/package.json +1 -1
- package/lib/dependencies/ImportDependencyTemplate.js +0 -50
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { View, NativeSyntheticEvent, ViewStyle } from 'react-native';
|
|
3
|
+
import { HandlerRef } from './useNodesRef';
|
|
4
|
+
interface StickyHeaderProps {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
style?: ViewStyle;
|
|
7
|
+
padding?: [number, number, number, number];
|
|
8
|
+
'offset-top'?: number;
|
|
9
|
+
'enable-var'?: boolean;
|
|
10
|
+
'external-var-context'?: Record<string, any>;
|
|
11
|
+
'parent-font-size'?: number;
|
|
12
|
+
'parent-width'?: number;
|
|
13
|
+
'parent-height'?: number;
|
|
14
|
+
bindstickontopchange?: (e: NativeSyntheticEvent<unknown>) => void;
|
|
15
|
+
}
|
|
16
|
+
declare const _StickyHeader: import("react").ForwardRefExoticComponent<StickyHeaderProps & import("react").RefAttributes<HandlerRef<View, StickyHeaderProps>>>;
|
|
17
|
+
export default _StickyHeader;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { View, ViewStyle } from 'react-native';
|
|
3
|
+
import { HandlerRef } from './useNodesRef';
|
|
4
|
+
interface StickySectionProps {
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
style?: ViewStyle;
|
|
7
|
+
'offset-top'?: number;
|
|
8
|
+
'enable-var'?: boolean;
|
|
9
|
+
'external-var-context'?: Record<string, any>;
|
|
10
|
+
'parent-font-size'?: number;
|
|
11
|
+
'parent-width'?: number;
|
|
12
|
+
'parent-height'?: number;
|
|
13
|
+
}
|
|
14
|
+
declare const _StickySection: import("react").ForwardRefExoticComponent<StickySectionProps & import("react").RefAttributes<HandlerRef<View, StickySectionProps>>>;
|
|
15
|
+
export default _StickySection;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { HandlerRef } from './useNodesRef';
|
|
4
|
+
interface SwiperItemProps {
|
|
5
|
+
'item-id'?: string;
|
|
6
|
+
'enable-offset'?: boolean;
|
|
7
|
+
'enable-var': boolean;
|
|
8
|
+
'external-var-context'?: Record<string, any>;
|
|
9
|
+
'parent-font-size'?: number;
|
|
10
|
+
'parent-width'?: number;
|
|
11
|
+
'parent-height'?: number;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
style?: Object;
|
|
14
|
+
customStyle: Object;
|
|
15
|
+
itemIndex: number;
|
|
16
|
+
}
|
|
17
|
+
declare const _SwiperItem: import("react").ForwardRefExoticComponent<SwiperItemProps & import("react").RefAttributes<HandlerRef<View, SwiperItemProps>>>;
|
|
18
|
+
export default _SwiperItem;
|
|
@@ -34,7 +34,7 @@ const _SwiperItem = forwardRef((props, ref) => {
|
|
|
34
34
|
const inputRange = [step.value, 0];
|
|
35
35
|
const outputRange = [0.7, 1];
|
|
36
36
|
// 实现元素的宽度跟随step从0到真实宽度,且不能触发重新渲染整个组件,通过AnimatedStyle的方式实现
|
|
37
|
-
const outerLayoutStyle = dir === 'x' ? { width: step.value, height: '100%' } : { width: '100%', height: step.value };
|
|
37
|
+
const outerLayoutStyle = dir === 'x' ? { width: step.value || '100%', height: '100%' } : { width: '100%', height: step.value || '100%' };
|
|
38
38
|
const transformStyle = [];
|
|
39
39
|
if (scale) {
|
|
40
40
|
transformStyle.push({
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { View, NativeSyntheticEvent } from 'react-native';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
|
+
import { HandlerRef } from './useNodesRef';
|
|
4
|
+
import { GestureHandler } from './utils';
|
|
5
|
+
/**
|
|
6
|
+
* ✔ indicator-dots
|
|
7
|
+
* ✔ indicator-color
|
|
8
|
+
* ✔ indicator-active-color
|
|
9
|
+
* ✔ autoplay
|
|
10
|
+
* ✔ current
|
|
11
|
+
* ✔ interval
|
|
12
|
+
* ✔ duration
|
|
13
|
+
* ✔ circular
|
|
14
|
+
* ✔ vertical
|
|
15
|
+
* ✔ previous-margin
|
|
16
|
+
* ✔ next-margin
|
|
17
|
+
* ✔ easing-function ="easeOutCubic"
|
|
18
|
+
* ✘ display-multiple-items
|
|
19
|
+
* ✘ snap-to-edge
|
|
20
|
+
*/
|
|
21
|
+
type EaseType = 'default' | 'linear' | 'easeInCubic' | 'easeOutCubic' | 'easeInOutCubic';
|
|
22
|
+
interface SwiperProps {
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
circular?: boolean;
|
|
25
|
+
current?: number;
|
|
26
|
+
interval?: number;
|
|
27
|
+
autoplay?: boolean;
|
|
28
|
+
duration?: number;
|
|
29
|
+
scale?: boolean;
|
|
30
|
+
'indicator-dots'?: boolean;
|
|
31
|
+
'indicator-color'?: string;
|
|
32
|
+
'indicator-active-color'?: string;
|
|
33
|
+
vertical?: boolean;
|
|
34
|
+
style: {
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
};
|
|
37
|
+
'easing-function'?: EaseType;
|
|
38
|
+
'previous-margin'?: string;
|
|
39
|
+
'next-margin'?: string;
|
|
40
|
+
'enable-offset'?: boolean;
|
|
41
|
+
'enable-var': boolean;
|
|
42
|
+
'parent-font-size'?: number;
|
|
43
|
+
'parent-width'?: number;
|
|
44
|
+
'parent-height'?: number;
|
|
45
|
+
'external-var-context'?: Record<string, any>;
|
|
46
|
+
'wait-for'?: Array<GestureHandler>;
|
|
47
|
+
'simultaneous-handlers'?: Array<GestureHandler>;
|
|
48
|
+
disableGesture?: boolean;
|
|
49
|
+
bindchange?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void;
|
|
50
|
+
bindtransition?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void;
|
|
51
|
+
bindanimationfinish?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void;
|
|
52
|
+
}
|
|
53
|
+
declare const SwiperWrapper: React.ForwardRefExoticComponent<SwiperProps & React.RefAttributes<HandlerRef<View, SwiperProps>>>;
|
|
54
|
+
export default SwiperWrapper;
|
|
@@ -4,7 +4,7 @@ import Animated, { useAnimatedStyle, useSharedValue, withTiming, Easing, runOnJS
|
|
|
4
4
|
import React, { forwardRef, useRef, useEffect, useMemo, createElement } from 'react';
|
|
5
5
|
import useInnerProps, { getCustomEvent } from './getInnerListeners';
|
|
6
6
|
import useNodesRef from './useNodesRef'; // 引入辅助函数
|
|
7
|
-
import { useTransformStyle, splitStyle, splitProps, useLayout, wrapChildren, extendObject, flatGesture, useRunOnJSCallback } from './utils';
|
|
7
|
+
import { useTransformStyle, splitStyle, splitProps, useLayout, wrapChildren, extendObject, flatGesture, useRunOnJSCallback, isHarmony } from './utils';
|
|
8
8
|
import { SwiperContext } from './context';
|
|
9
9
|
import Portal from './mpx-portal';
|
|
10
10
|
/**
|
|
@@ -71,7 +71,7 @@ const easeMap = {
|
|
|
71
71
|
easeInOutCubic: Easing.inOut(Easing.cubic)
|
|
72
72
|
};
|
|
73
73
|
const SwiperWrapper = forwardRef((props, ref) => {
|
|
74
|
-
const { 'indicator-dots': showPagination, 'indicator-color': dotColor = 'rgba(0, 0, 0, .3)', 'indicator-active-color': activeDotColor = '#000000', 'enable-var': enableVar = false, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, 'external-var-context': externalVarContext, 'simultaneous-handlers': originSimultaneousHandlers = [], 'wait-for': waitFor = [], style = {}, autoplay = false, circular = false, disableGesture = false, current: propCurrent = 0, bindchange } = props;
|
|
74
|
+
const { 'indicator-dots': showPagination, 'indicator-color': dotColor = 'rgba(0, 0, 0, .3)', 'indicator-active-color': activeDotColor = '#000000', 'enable-var': enableVar = false, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, 'external-var-context': externalVarContext, 'simultaneous-handlers': originSimultaneousHandlers = [], 'wait-for': waitFor = [], style = {}, autoplay = false, circular = false, disableGesture = false, current: propCurrent = 0, bindchange, bindtransition, bindanimationfinish } = props;
|
|
75
75
|
const easeingFunc = props['easing-function'] || 'default';
|
|
76
76
|
const easeDuration = props.duration || 500;
|
|
77
77
|
const horizontal = props.vertical !== undefined ? !props.vertical : true;
|
|
@@ -275,6 +275,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
275
275
|
}, () => {
|
|
276
276
|
currentIndex.value = nextIndex;
|
|
277
277
|
runOnJS(runOnJSCallback)('loop');
|
|
278
|
+
bindanimationfinish && runOnJS(runOnJSCallback)('handleAnimationfinish', nextIndex);
|
|
278
279
|
});
|
|
279
280
|
}
|
|
280
281
|
else {
|
|
@@ -291,6 +292,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
291
292
|
offset.value = initOffset;
|
|
292
293
|
currentIndex.value = nextIndex;
|
|
293
294
|
runOnJS(runOnJSCallback)('loop');
|
|
295
|
+
bindanimationfinish && runOnJS(runOnJSCallback)('handleAnimationfinish', nextIndex);
|
|
294
296
|
});
|
|
295
297
|
}
|
|
296
298
|
else {
|
|
@@ -303,6 +305,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
303
305
|
}, () => {
|
|
304
306
|
currentIndex.value = nextIndex;
|
|
305
307
|
runOnJS(runOnJSCallback)('loop');
|
|
308
|
+
runOnJS(runOnJSCallback)('handleAnimationfinish', nextIndex);
|
|
306
309
|
});
|
|
307
310
|
}
|
|
308
311
|
}
|
|
@@ -331,11 +334,21 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
331
334
|
const eventData = getCustomEvent('change', {}, { detail: { current, source: 'touch' }, layoutRef: layoutRef });
|
|
332
335
|
bindchange && bindchange(eventData);
|
|
333
336
|
}
|
|
337
|
+
function handleTransition(transData) {
|
|
338
|
+
const eventData = getCustomEvent('change', {}, { detail: transData, layoutRef: layoutRef });
|
|
339
|
+
bindtransition && bindtransition(eventData);
|
|
340
|
+
}
|
|
341
|
+
function handleAnimationfinish(current) {
|
|
342
|
+
const eventData = getCustomEvent('change', {}, { detail: { current, source: 'touch' }, layoutRef: layoutRef });
|
|
343
|
+
bindanimationfinish && bindanimationfinish(eventData);
|
|
344
|
+
}
|
|
334
345
|
const runOnJSCallbackRef = useRef({
|
|
335
346
|
loop,
|
|
336
347
|
pauseLoop,
|
|
337
348
|
resumeLoop,
|
|
338
|
-
handleSwiperChange
|
|
349
|
+
handleSwiperChange,
|
|
350
|
+
handleTransition,
|
|
351
|
+
handleAnimationfinish
|
|
339
352
|
});
|
|
340
353
|
const runOnJSCallback = useRunOnJSCallback(runOnJSCallbackRef);
|
|
341
354
|
function getOffset(index, stepValue) {
|
|
@@ -361,6 +374,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
361
374
|
easing: easeMap[easeingFunc]
|
|
362
375
|
}, () => {
|
|
363
376
|
currentIndex.value = propCurrent;
|
|
377
|
+
bindanimationfinish && runOnJS(runOnJSCallback)('handleAnimationfinish', propCurrent);
|
|
364
378
|
});
|
|
365
379
|
}
|
|
366
380
|
else {
|
|
@@ -383,6 +397,28 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
383
397
|
runOnJS(runOnJSCallback)('handleSwiperChange', newIndex, propCurrent);
|
|
384
398
|
}
|
|
385
399
|
});
|
|
400
|
+
useAnimatedReaction(() => offset.value, (curOffset, preOffset) => {
|
|
401
|
+
const curAbsOffset = Math.abs(curOffset);
|
|
402
|
+
const preAbsOffset = Math.abs(preOffset || 0);
|
|
403
|
+
const computeOffset = step.value * (currentIndex.value + patchElmNumShared.value);
|
|
404
|
+
// 有小数点的情况
|
|
405
|
+
const isEqual = Math.abs(Math.floor(computeOffset) - Math.floor(Math.abs(offset.value))) <= 2;
|
|
406
|
+
if (curAbsOffset !== preAbsOffset && curAbsOffset && !isEqual) {
|
|
407
|
+
// 移动的距离,手向左滑动正数( curAbsOffset >= preAbsOffset),右右滑动是负数( curAbsOffset < preAbsOffset)
|
|
408
|
+
let trans = 0;
|
|
409
|
+
if (curAbsOffset >= preAbsOffset) {
|
|
410
|
+
trans = curAbsOffset % step.value;
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
trans = -(step.value - curAbsOffset % step.value);
|
|
414
|
+
}
|
|
415
|
+
const transData = {
|
|
416
|
+
dx: dir === 'x' ? trans : 0,
|
|
417
|
+
dy: dir === 'y' ? trans : 0
|
|
418
|
+
};
|
|
419
|
+
bindtransition && runOnJS(runOnJSCallback)('handleTransition', transData);
|
|
420
|
+
}
|
|
421
|
+
});
|
|
386
422
|
useEffect(() => {
|
|
387
423
|
let patchStep = 0;
|
|
388
424
|
if (preMargin !== preMarginShared.value) {
|
|
@@ -510,6 +546,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
510
546
|
currentIndex.value = selectedIndex;
|
|
511
547
|
offset.value = resetOffset;
|
|
512
548
|
runOnJS(runOnJSCallback)('resumeLoop');
|
|
549
|
+
bindanimationfinish && runOnJS(runOnJSCallback)('handleAnimationfinish', selectedIndex);
|
|
513
550
|
}
|
|
514
551
|
});
|
|
515
552
|
}
|
|
@@ -521,6 +558,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
521
558
|
if (touchfinish.value !== false) {
|
|
522
559
|
currentIndex.value = selectedIndex;
|
|
523
560
|
runOnJS(runOnJSCallback)('resumeLoop');
|
|
561
|
+
bindanimationfinish && runOnJS(runOnJSCallback)('handleAnimationfinish', selectedIndex);
|
|
524
562
|
}
|
|
525
563
|
});
|
|
526
564
|
}
|
|
@@ -543,6 +581,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
543
581
|
if (touchfinish.value !== false) {
|
|
544
582
|
currentIndex.value = moveToIndex;
|
|
545
583
|
runOnJS(runOnJSCallback)('resumeLoop');
|
|
584
|
+
bindanimationfinish && runOnJS(runOnJSCallback)('handleAnimationfinish', moveToIndex);
|
|
546
585
|
}
|
|
547
586
|
});
|
|
548
587
|
}
|
|
@@ -697,6 +736,10 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
697
736
|
offset.value = moveDistance + offset.value;
|
|
698
737
|
}
|
|
699
738
|
preAbsolutePos.value = e[strAbso];
|
|
739
|
+
})
|
|
740
|
+
.onEnd((e) => {
|
|
741
|
+
// 修复某些安卓机型小米 onFinalize拿到的absolute值不正确的问题, onUpdate并不是最终的值
|
|
742
|
+
preAbsolutePos.value = e[strAbso];
|
|
700
743
|
})
|
|
701
744
|
.onFinalize((e) => {
|
|
702
745
|
'worklet';
|
|
@@ -764,11 +807,12 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
764
807
|
};
|
|
765
808
|
}, [gestureSwitch.current]);
|
|
766
809
|
const animatedStyles = useAnimatedStyle(() => {
|
|
810
|
+
const opacity = isHarmony ? 1 : (step.value > 0 ? 1 : 0);
|
|
767
811
|
if (dir === 'x') {
|
|
768
|
-
return { transform: [{ translateX: offset.value }], opacity
|
|
812
|
+
return { transform: [{ translateX: offset.value }], opacity };
|
|
769
813
|
}
|
|
770
814
|
else {
|
|
771
|
-
return { transform: [{ translateY: offset.value }], opacity
|
|
815
|
+
return { transform: [{ translateY: offset.value }], opacity };
|
|
772
816
|
}
|
|
773
817
|
});
|
|
774
818
|
let finalComponent;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/**
|
|
3
|
+
* ✔ checked
|
|
4
|
+
* ✔ type
|
|
5
|
+
* ✔ disabled
|
|
6
|
+
* ✔ color
|
|
7
|
+
*/
|
|
8
|
+
import { Switch, SwitchProps, ViewStyle, NativeSyntheticEvent } from 'react-native';
|
|
9
|
+
import { HandlerRef } from './useNodesRef';
|
|
10
|
+
interface _SwitchProps extends SwitchProps {
|
|
11
|
+
style?: ViewStyle;
|
|
12
|
+
name?: string;
|
|
13
|
+
checked?: boolean;
|
|
14
|
+
type: 'switch' | 'checkbox';
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
color: string;
|
|
17
|
+
'enable-var'?: boolean;
|
|
18
|
+
'parent-font-size'?: number;
|
|
19
|
+
'parent-width'?: number;
|
|
20
|
+
'parent-height'?: number;
|
|
21
|
+
'external-var-context'?: Record<string, any>;
|
|
22
|
+
bindchange?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void;
|
|
23
|
+
catchchange?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void;
|
|
24
|
+
}
|
|
25
|
+
declare const _Switch: import("react").ForwardRefExoticComponent<_SwitchProps & import("react").RefAttributes<HandlerRef<Switch, _SwitchProps>>>;
|
|
26
|
+
export default _Switch;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ✔ selectable
|
|
3
|
+
* ✘ space
|
|
4
|
+
* ✘ decode
|
|
5
|
+
*/
|
|
6
|
+
import { Text, TextStyle, TextProps } from 'react-native';
|
|
7
|
+
import { ReactNode } from 'react';
|
|
8
|
+
import { HandlerRef } from './useNodesRef';
|
|
9
|
+
interface _TextProps extends TextProps {
|
|
10
|
+
style?: TextStyle;
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
selectable?: boolean;
|
|
13
|
+
'user-select'?: boolean;
|
|
14
|
+
'enable-var'?: boolean;
|
|
15
|
+
'external-var-context'?: Record<string, any>;
|
|
16
|
+
'parent-font-size'?: number;
|
|
17
|
+
'parent-width'?: number;
|
|
18
|
+
'parent-height'?: number;
|
|
19
|
+
}
|
|
20
|
+
declare const _Text: import("react").ForwardRefExoticComponent<_TextProps & import("react").RefAttributes<HandlerRef<Text, _TextProps>>>;
|
|
21
|
+
export default _Text;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TextInput } from 'react-native';
|
|
3
|
+
import { InputProps, PrivateInputProps } from './mpx-input';
|
|
4
|
+
import { HandlerRef } from './useNodesRef';
|
|
5
|
+
export type TextareProps = Omit<InputProps & PrivateInputProps, 'type' | 'password' | 'multiline' | 'confirm-hold'>;
|
|
6
|
+
declare const Textarea: import("react").ForwardRefExoticComponent<TextareProps & import("react").RefAttributes<HandlerRef<TextInput, TextareProps>>>;
|
|
7
|
+
export default Textarea;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ✔ src
|
|
3
|
+
* ✘ duration
|
|
4
|
+
* ✔ controls
|
|
5
|
+
* ✘ danmu-list
|
|
6
|
+
* ✘ danmu-btn
|
|
7
|
+
* ✘ enable-danmu
|
|
8
|
+
* ✔ autoplay
|
|
9
|
+
* ✔ loop
|
|
10
|
+
* ✔ muted
|
|
11
|
+
* ✔ initial-time
|
|
12
|
+
* ✘ page-gesture
|
|
13
|
+
* ✘ direction
|
|
14
|
+
* ✘ show-progress
|
|
15
|
+
* ✘ show-fullscreen-btn
|
|
16
|
+
* ✘ show-play-btn
|
|
17
|
+
* ✘ show-center-play-btn
|
|
18
|
+
* ✘ enable-progress-gesture
|
|
19
|
+
* ✔ object-fit
|
|
20
|
+
* ✔ poster
|
|
21
|
+
* ✘ show-mute-btn
|
|
22
|
+
* ✘ title
|
|
23
|
+
* ✘ play-btn-position
|
|
24
|
+
* ✘ enable-play-gesture
|
|
25
|
+
* ✘ auto-pause-if-navigate
|
|
26
|
+
* ✘ auto-pause-if-open-native
|
|
27
|
+
* ✘ vslide-gesture
|
|
28
|
+
* ✘ vslide-gesture-in-fullscreen
|
|
29
|
+
* ✘ show-bottom-progress(use show-progress)
|
|
30
|
+
* ✘ ad-unit-id
|
|
31
|
+
* ✘ poster-for-crawler
|
|
32
|
+
* ✘ show-casting-button
|
|
33
|
+
* ✘ picture-in-picture-mode
|
|
34
|
+
* ✘ picture-in-picture-show-progress
|
|
35
|
+
* ✘ picture-in-picture-init-position
|
|
36
|
+
* ✔ enable-auto-rotation (only ios)
|
|
37
|
+
* ✘ show-screen-lock-button
|
|
38
|
+
* ✘ show-snapshot-button
|
|
39
|
+
* ✘ show-background-playback-button
|
|
40
|
+
* ✘ background-poster
|
|
41
|
+
* ✘ referrer-policy
|
|
42
|
+
* ✔ is-drm
|
|
43
|
+
* ✘ is-live
|
|
44
|
+
* ✔ provision-url(android)
|
|
45
|
+
* ✔ certificate-url(ios)
|
|
46
|
+
* ✔ license-url
|
|
47
|
+
* ✔ preferred-peak-bit-rate
|
|
48
|
+
* ✔ bindplay
|
|
49
|
+
* ✔ bindpause
|
|
50
|
+
* ✔ bindended
|
|
51
|
+
* ✘ bindtimeupdate
|
|
52
|
+
* ✔ bindfullscreenchange
|
|
53
|
+
* ✔ bindwaiting
|
|
54
|
+
* ✔ binderror
|
|
55
|
+
* ✘ bindprogress
|
|
56
|
+
* ✔ bindloadedmetadata
|
|
57
|
+
* ✔ bindcontrolstoggle(only android)
|
|
58
|
+
* ✘ bindenterpictureinpicture
|
|
59
|
+
* ✘ bindleavepictureinpicture
|
|
60
|
+
* ✔ bindseekcomplete
|
|
61
|
+
* ✘ bindcastinguserselect
|
|
62
|
+
* ✘ bindcastingstatechange
|
|
63
|
+
* ✘ bindcastinginterrupt
|
|
64
|
+
*/
|
|
65
|
+
/// <reference types="react" />
|
|
66
|
+
import { View, ViewStyle } from 'react-native';
|
|
67
|
+
import { HandlerRef } from './useNodesRef';
|
|
68
|
+
interface VideoProps {
|
|
69
|
+
src: string;
|
|
70
|
+
autoplay?: boolean;
|
|
71
|
+
loop?: boolean;
|
|
72
|
+
muted?: boolean;
|
|
73
|
+
controls?: boolean;
|
|
74
|
+
poster?: string;
|
|
75
|
+
style?: ViewStyle;
|
|
76
|
+
'initial-time'?: number;
|
|
77
|
+
'object-fit'?: null | 'contain' | 'fill' | 'cover';
|
|
78
|
+
'is-drm'?: boolean;
|
|
79
|
+
'provision-url'?: string;
|
|
80
|
+
'certificate-url'?: string;
|
|
81
|
+
'license-url'?: string;
|
|
82
|
+
'preferred-peak-bit-rate'?: number;
|
|
83
|
+
'enable-auto-rotation'?: number;
|
|
84
|
+
'enable-var'?: boolean;
|
|
85
|
+
'external-var-context'?: Record<string, any>;
|
|
86
|
+
'parent-font-size'?: number;
|
|
87
|
+
'parent-width'?: number;
|
|
88
|
+
'parent-height'?: number;
|
|
89
|
+
bindplay?: (event: Record<string, any>) => void;
|
|
90
|
+
bindpause?: (event: Record<string, any>) => void;
|
|
91
|
+
bindended?: (event: Record<string, any>) => void;
|
|
92
|
+
bindtimeupdate?: (event: Record<string, any>) => void;
|
|
93
|
+
bindfullscreenchange?: (event: Record<string, any>) => void;
|
|
94
|
+
bindwaiting?: (event: Record<string, any>) => void;
|
|
95
|
+
binderror?: (event: Record<string, any>) => void;
|
|
96
|
+
bindloadedmetadata?: (event: Record<string, any>) => void;
|
|
97
|
+
bindcontrolstoggle?: (event: Record<string, any>) => void;
|
|
98
|
+
bindseekcomplete?: (event: Record<string, any>) => void;
|
|
99
|
+
}
|
|
100
|
+
declare const MpxVideo: import("react").ForwardRefExoticComponent<VideoProps & import("react").RefAttributes<HandlerRef<View, VideoProps>>>;
|
|
101
|
+
export default MpxVideo;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ✔ hover-class
|
|
3
|
+
* ✘ hover-stop-propagation
|
|
4
|
+
* ✔ hover-start-time
|
|
5
|
+
* ✔ hover-stay-time
|
|
6
|
+
*/
|
|
7
|
+
import { View, NativeSyntheticEvent, ViewProps } from 'react-native';
|
|
8
|
+
import { ReactNode } from 'react';
|
|
9
|
+
import type { AnimationProp } from './useAnimationHooks';
|
|
10
|
+
import { ExtendedViewStyle } from './types/common';
|
|
11
|
+
import { HandlerRef } from './useNodesRef';
|
|
12
|
+
export interface _ViewProps extends ViewProps {
|
|
13
|
+
style?: ExtendedViewStyle;
|
|
14
|
+
animation?: AnimationProp;
|
|
15
|
+
children?: ReactNode | ReactNode[];
|
|
16
|
+
'hover-style'?: ExtendedViewStyle;
|
|
17
|
+
'hover-start-time'?: number;
|
|
18
|
+
'hover-stay-time'?: number;
|
|
19
|
+
'enable-background'?: boolean;
|
|
20
|
+
'enable-var'?: boolean;
|
|
21
|
+
'enable-fast-image'?: boolean;
|
|
22
|
+
'external-var-context'?: Record<string, any>;
|
|
23
|
+
'parent-font-size'?: number;
|
|
24
|
+
'parent-width'?: number;
|
|
25
|
+
'parent-height'?: number;
|
|
26
|
+
'enable-animation'?: boolean;
|
|
27
|
+
bindtouchstart?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void;
|
|
28
|
+
bindtouchmove?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void;
|
|
29
|
+
bindtouchend?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void;
|
|
30
|
+
bindtransitionend?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void;
|
|
31
|
+
catchtransitionend?: (event: NativeSyntheticEvent<TouchEvent> | unknown) => void;
|
|
32
|
+
}
|
|
33
|
+
declare const _View: import("react").ForwardRefExoticComponent<_ViewProps & import("react").RefAttributes<HandlerRef<View, _ViewProps>>>;
|
|
34
|
+
export default _View;
|
|
@@ -203,7 +203,7 @@ function backgroundSize(imageProps, preImageInfo, imageSize, layoutInfo) {
|
|
|
203
203
|
else { // 数值类型 ImageStyle
|
|
204
204
|
// 数值类型设置为 stretch
|
|
205
205
|
imageProps.resizeMode = 'stretch';
|
|
206
|
-
if (type === 'linear' && (!layoutWidth || !layoutHeight)) {
|
|
206
|
+
if (type === 'linear' && (!layoutWidth || !layoutHeight) && isNeedLayout(preImageInfo)) {
|
|
207
207
|
// ios 上 linear 组件只要重新触发渲染,在渲染过程中外层容器 width 或者 height 被设置为 0,通过设置 % 的方式会渲染不出来,即使后面再更新为正常宽高也渲染不出来
|
|
208
208
|
// 所以 hack 手动先将 linear 宽高也设置为 0,后面再更新为正确的数值或 %。
|
|
209
209
|
dimensions = {
|
|
@@ -212,6 +212,7 @@ function backgroundSize(imageProps, preImageInfo, imageSize, layoutInfo) {
|
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
else {
|
|
215
|
+
// background-size 手动设置具体值,不会触发 onLayout,需要走这里的逻辑
|
|
215
216
|
dimensions = {
|
|
216
217
|
width: isPercent(width) ? width : +width,
|
|
217
218
|
height: isPercent(height) ? height : +height
|
|
@@ -398,7 +399,7 @@ function parseLinearGradient(text) {
|
|
|
398
399
|
});
|
|
399
400
|
}
|
|
400
401
|
function parseBgImage(text) {
|
|
401
|
-
if (!text)
|
|
402
|
+
if (!text || text === 'none')
|
|
402
403
|
return {};
|
|
403
404
|
const src = parseUrl(text);
|
|
404
405
|
if (src)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { WebView } from 'react-native-webview';
|
|
3
|
+
import { HandlerRef } from './useNodesRef';
|
|
4
|
+
type OnMessageCallbackEvent = {
|
|
5
|
+
detail: {
|
|
6
|
+
data: any[];
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
type CommonCallbackEvent = {
|
|
10
|
+
detail: {
|
|
11
|
+
src?: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
interface WebViewProps {
|
|
15
|
+
src?: string;
|
|
16
|
+
bindmessage?: (event: OnMessageCallbackEvent) => void;
|
|
17
|
+
bindload?: (event: CommonCallbackEvent) => void;
|
|
18
|
+
binderror?: (event: CommonCallbackEvent) => void;
|
|
19
|
+
[x: string]: any;
|
|
20
|
+
}
|
|
21
|
+
declare const _WebView: import("react").ForwardRefExoticComponent<Omit<WebViewProps, "ref"> & import("react").RefAttributes<HandlerRef<WebView<{}>, WebViewProps>>>;
|
|
22
|
+
export default _WebView;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare function useInnerHeaderHeight(pageConfig: PageConfig): number;
|
|
3
|
+
export interface MpxNavProps {
|
|
4
|
+
pageConfig: PageConfig;
|
|
5
|
+
navigation: any;
|
|
6
|
+
}
|
|
7
|
+
declare const MpxNav: import("react").MemoExoticComponent<({ pageConfig, navigation }: MpxNavProps) => import("react").JSX.Element>;
|
|
8
|
+
export default MpxNav;
|