@mpxjs/webpack-plugin 2.10.7 → 2.10.8-beta.3
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/RecordPageConfigsMapDependency.js +1 -1
- package/lib/dependencies/RequireExternalDependency.js +61 -0
- package/lib/file-loader.js +3 -2
- package/lib/index.js +55 -9
- package/lib/json-compiler/index.js +1 -0
- package/lib/parser.js +1 -1
- package/lib/platform/json/wx/index.js +43 -25
- package/lib/platform/style/wx/index.js +7 -0
- package/lib/platform/template/wx/component-config/fix-component-name.js +2 -2
- package/lib/platform/template/wx/component-config/index.js +9 -1
- package/lib/platform/template/wx/component-config/nav-container.js +27 -0
- package/lib/platform/template/wx/component-config/page-container.js +19 -0
- 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/unsupported.js +1 -1
- package/lib/react/LoadAsyncChunkModule.js +74 -0
- package/lib/react/index.js +3 -1
- package/lib/react/processJSON.js +74 -13
- package/lib/react/processScript.js +6 -6
- package/lib/react/script-helper.js +100 -41
- package/lib/runtime/components/ali/mpx-nav-container.mpx +3 -0
- package/lib/runtime/components/react/context.ts +27 -7
- package/lib/runtime/components/react/dist/context.d.ts +78 -0
- package/lib/runtime/components/react/dist/context.js +5 -1
- 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-async-suspense.jsx +135 -0
- package/lib/runtime/components/react/dist/mpx-button.d.ts +68 -0
- package/lib/runtime/components/react/dist/mpx-button.jsx +2 -2
- 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 +49 -0
- package/lib/runtime/components/react/dist/mpx-input.jsx +28 -9
- 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 +42 -46
- 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-movable-view.jsx +8 -6
- 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-page-container.d.ts +27 -0
- package/lib/runtime/components/react/dist/mpx-page-container.jsx +255 -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-scroll-view.jsx +31 -15
- 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-header.jsx +117 -0
- package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts +15 -0
- package/lib/runtime/components/react/dist/mpx-sticky-section.jsx +45 -0
- package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts +18 -0
- package/lib/runtime/components/react/dist/mpx-swiper.d.ts +52 -0
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +3 -2
- 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-video.d.ts +101 -0
- package/lib/runtime/components/react/dist/mpx-view.d.ts +34 -0
- package/lib/runtime/components/react/dist/mpx-web-view.d.ts +22 -0
- package/lib/runtime/components/react/dist/nav.d.ts +11 -0
- package/lib/runtime/components/react/dist/nav.jsx +141 -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 +121 -0
- package/lib/runtime/components/react/mpx-async-suspense.tsx +180 -0
- package/lib/runtime/components/react/mpx-button.tsx +3 -2
- package/lib/runtime/components/react/mpx-input.tsx +35 -16
- package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +46 -45
- package/lib/runtime/components/react/mpx-movable-view.tsx +8 -4
- package/lib/runtime/components/react/mpx-nav-container.tsx +33 -0
- package/lib/runtime/components/react/mpx-page-container.tsx +394 -0
- package/lib/runtime/components/react/mpx-scroll-view.tsx +84 -59
- package/lib/runtime/components/react/mpx-sticky-header.tsx +181 -0
- package/lib/runtime/components/react/mpx-sticky-section.tsx +96 -0
- package/lib/runtime/components/react/mpx-swiper.tsx +4 -2
- package/lib/runtime/components/react/nav.tsx +172 -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/web/mpx-scroll-view.vue +18 -4
- package/lib/runtime/components/web/mpx-sticky-header.vue +99 -0
- package/lib/runtime/components/web/mpx-sticky-section.vue +15 -0
- package/lib/runtime/components/wx/mpx-nav-container.mpx +9 -0
- package/lib/runtime/optionProcessorReact.d.ts +18 -0
- package/lib/runtime/optionProcessorReact.js +30 -0
- package/lib/script-setup-compiler/index.js +27 -5
- package/lib/template-compiler/bind-this.js +2 -1
- package/lib/template-compiler/compiler.js +27 -6
- package/lib/utils/dom-tag-config.js +18 -4
- package/lib/utils/trans-async-sub-rules.js +19 -0
- package/lib/web/script-helper.js +1 -1
- package/package.json +4 -4
- package/LICENSE +0 -433
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
type KeyboardAvoidViewProps = {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
style?: ViewStyle;
|
|
6
|
+
contentContainerStyle?: ViewStyle;
|
|
7
|
+
};
|
|
8
|
+
declare const KeyboardAvoidingView: {
|
|
9
|
+
({ children, style, contentContainerStyle }: KeyboardAvoidViewProps): React.JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
export default KeyboardAvoidingView;
|
|
@@ -1,20 +1,31 @@
|
|
|
1
1
|
import React, { useContext, useEffect } from 'react';
|
|
2
2
|
import { Keyboard, View } from 'react-native';
|
|
3
|
-
import Animated, { useSharedValue, useAnimatedStyle, withTiming, Easing } from 'react-native-reanimated';
|
|
3
|
+
import Animated, { useSharedValue, useAnimatedStyle, withTiming, Easing, cancelAnimation } from 'react-native-reanimated';
|
|
4
4
|
import { KeyboardAvoidContext } from './context';
|
|
5
5
|
import { isIOS } from './utils';
|
|
6
6
|
const KeyboardAvoidingView = ({ children, style, contentContainerStyle }) => {
|
|
7
7
|
const duration = isIOS ? 250 : 300;
|
|
8
8
|
const easing = isIOS ? Easing.inOut(Easing.ease) : Easing.out(Easing.quad);
|
|
9
|
+
const isShow = React.useRef(false);
|
|
9
10
|
const offset = useSharedValue(0);
|
|
10
11
|
const basic = useSharedValue('auto');
|
|
11
12
|
const keyboardAvoid = useContext(KeyboardAvoidContext);
|
|
12
13
|
const animatedStyle = useAnimatedStyle(() => ({
|
|
13
|
-
|
|
14
|
+
// translate/position top可能会导致地步渲染区域缺失
|
|
15
|
+
marginTop: -offset.value,
|
|
14
16
|
flexBasis: basic.value
|
|
15
17
|
}));
|
|
16
18
|
const resetKeyboard = () => {
|
|
19
|
+
if (!isShow.current) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
isShow.current = false;
|
|
17
23
|
if (keyboardAvoid?.current) {
|
|
24
|
+
const inputRef = keyboardAvoid.current.ref?.current;
|
|
25
|
+
if (inputRef && inputRef.isFocused()) {
|
|
26
|
+
// 修复 Android 点击键盘收起按钮时当前 input 没触发失焦的问题
|
|
27
|
+
inputRef.blur();
|
|
28
|
+
}
|
|
18
29
|
keyboardAvoid.current = null;
|
|
19
30
|
}
|
|
20
31
|
offset.value = withTiming(0, { duration, easing });
|
|
@@ -27,52 +38,42 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }) => {
|
|
|
27
38
|
};
|
|
28
39
|
useEffect(() => {
|
|
29
40
|
let subscriptions = [];
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const belowValue = Math.min(endCoordinates.height, aboveOffset + cursorSpacing);
|
|
42
|
-
const value = aboveOffset > 0 ? belowValue : aboveValue;
|
|
43
|
-
offset.value = withTiming(value, { duration, easing }, (finished) => {
|
|
44
|
-
if (finished) {
|
|
45
|
-
// Set flexBasic after animation to trigger re-layout and reset layout information
|
|
46
|
-
basic.value = '99.99%';
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
}),
|
|
52
|
-
Keyboard.addListener('keyboardWillHide', resetKeyboard)
|
|
53
|
-
];
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
subscriptions = [
|
|
57
|
-
Keyboard.addListener('keyboardDidShow', (evt) => {
|
|
58
|
-
if (!keyboardAvoid?.current)
|
|
59
|
-
return;
|
|
60
|
-
const { endCoordinates } = evt;
|
|
61
|
-
const { ref, cursorSpacing = 0 } = keyboardAvoid.current;
|
|
41
|
+
function keybaordAvoding(evt) {
|
|
42
|
+
if (!keyboardAvoid?.current || isShow.current) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
isShow.current = true;
|
|
46
|
+
const { endCoordinates } = evt;
|
|
47
|
+
const { ref, cursorSpacing = 0, adjustPosition, onKeyboardShow } = keyboardAvoid.current;
|
|
48
|
+
keyboardAvoid.current.keyboardHeight = endCoordinates.height;
|
|
49
|
+
onKeyboardShow?.();
|
|
50
|
+
if (adjustPosition) {
|
|
51
|
+
setTimeout(() => {
|
|
62
52
|
ref?.current?.measure((x, y, width, height, pageX, pageY) => {
|
|
63
|
-
const aboveOffset = pageY + height - endCoordinates.screenY;
|
|
64
|
-
const belowOffset = endCoordinates.height - aboveOffset;
|
|
53
|
+
const aboveOffset = offset.value + pageY + height - endCoordinates.screenY;
|
|
65
54
|
const aboveValue = -aboveOffset >= cursorSpacing ? 0 : aboveOffset + cursorSpacing;
|
|
66
|
-
const belowValue = Math.min(
|
|
55
|
+
const belowValue = Math.min(endCoordinates.height, aboveOffset + cursorSpacing);
|
|
67
56
|
const value = aboveOffset > 0 ? belowValue : aboveValue;
|
|
68
|
-
offset
|
|
57
|
+
cancelAnimation(offset);
|
|
58
|
+
offset.value = withTiming(value, { duration, easing }, finished => {
|
|
69
59
|
if (finished) {
|
|
70
60
|
// Set flexBasic after animation to trigger re-layout and reset layout information
|
|
71
61
|
basic.value = '99.99%';
|
|
72
62
|
}
|
|
73
63
|
});
|
|
74
64
|
});
|
|
75
|
-
})
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (isIOS) {
|
|
69
|
+
subscriptions = [
|
|
70
|
+
Keyboard.addListener('keyboardWillShow', keybaordAvoding),
|
|
71
|
+
Keyboard.addListener('keyboardWillHide', resetKeyboard)
|
|
72
|
+
];
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
subscriptions = [
|
|
76
|
+
Keyboard.addListener('keyboardDidShow', keybaordAvoding),
|
|
76
77
|
Keyboard.addListener('keyboardDidHide', resetKeyboard)
|
|
77
78
|
];
|
|
78
79
|
}
|
|
@@ -80,13 +81,8 @@ const KeyboardAvoidingView = ({ children, style, contentContainerStyle }) => {
|
|
|
80
81
|
subscriptions.forEach(subscription => subscription.remove());
|
|
81
82
|
};
|
|
82
83
|
}, [keyboardAvoid]);
|
|
83
|
-
return (<View style={style} onTouchEnd={onTouchEnd}>
|
|
84
|
-
<Animated.View style={[
|
|
85
|
-
contentContainerStyle,
|
|
86
|
-
animatedStyle
|
|
87
|
-
]}>
|
|
88
|
-
{children}
|
|
89
|
-
</Animated.View>
|
|
84
|
+
return (<View style={style} onTouchEnd={onTouchEnd} onTouchMove={onTouchEnd}>
|
|
85
|
+
<Animated.View style={[contentContainerStyle, animatedStyle]}>{children}</Animated.View>
|
|
90
86
|
</View>);
|
|
91
87
|
};
|
|
92
88
|
KeyboardAvoidingView.displayName = 'MpxKeyboardAvoidingView';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ✘ for
|
|
3
|
+
*/
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
import { View, ViewStyle, NativeSyntheticEvent } from 'react-native';
|
|
6
|
+
import { HandlerRef } from './useNodesRef';
|
|
7
|
+
export interface LabelProps {
|
|
8
|
+
for?: string;
|
|
9
|
+
style?: ViewStyle & Record<string, any>;
|
|
10
|
+
'enable-offset'?: boolean;
|
|
11
|
+
'enable-var'?: boolean;
|
|
12
|
+
'external-var-context'?: Record<string, any>;
|
|
13
|
+
'parent-font-size'?: number;
|
|
14
|
+
'parent-width'?: number;
|
|
15
|
+
'parent-height'?: number;
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
bindtap?: (evt: NativeSyntheticEvent<TouchEvent> | unknown) => void;
|
|
18
|
+
}
|
|
19
|
+
declare const Label: import("react").ForwardRefExoticComponent<LabelProps & import("react").RefAttributes<HandlerRef<View, LabelProps>>>;
|
|
20
|
+
export default Label;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ✘ scale-area
|
|
3
|
+
*/
|
|
4
|
+
import { View } from 'react-native';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
import { HandlerRef } from './useNodesRef';
|
|
7
|
+
interface MovableAreaProps {
|
|
8
|
+
style?: Record<string, any>;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
width?: number;
|
|
11
|
+
height?: number;
|
|
12
|
+
'enable-offset'?: boolean;
|
|
13
|
+
'enable-var'?: boolean;
|
|
14
|
+
'external-var-context'?: Record<string, any>;
|
|
15
|
+
'parent-font-size'?: number;
|
|
16
|
+
'parent-width'?: number;
|
|
17
|
+
'parent-height'?: number;
|
|
18
|
+
}
|
|
19
|
+
declare const _MovableArea: import("react").ForwardRefExoticComponent<MovableAreaProps & import("react").RefAttributes<HandlerRef<View, MovableAreaProps>>>;
|
|
20
|
+
export default _MovableArea;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ✔ direction
|
|
3
|
+
* ✔ inertia
|
|
4
|
+
* ✔ out-of-bounds
|
|
5
|
+
* ✔ x
|
|
6
|
+
* ✔ y
|
|
7
|
+
* ✘ damping
|
|
8
|
+
* ✘ friction
|
|
9
|
+
* ✔ disabled
|
|
10
|
+
* ✘ scale
|
|
11
|
+
* ✘ scale-min
|
|
12
|
+
* ✘ scale-max
|
|
13
|
+
* ✘ scale-value
|
|
14
|
+
* ✔ animation
|
|
15
|
+
* ✔ bindchange
|
|
16
|
+
* ✘ bindscale
|
|
17
|
+
* ✔ htouchmove
|
|
18
|
+
* ✔ vtouchmove
|
|
19
|
+
*/
|
|
20
|
+
import { ReactNode } from 'react';
|
|
21
|
+
import { View, LayoutChangeEvent } from 'react-native';
|
|
22
|
+
import { HandlerRef } from './useNodesRef';
|
|
23
|
+
import { GestureHandler } from './utils';
|
|
24
|
+
import { GestureTouchEvent } from 'react-native-gesture-handler';
|
|
25
|
+
interface MovableViewProps {
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
style?: Record<string, any>;
|
|
28
|
+
direction: 'all' | 'vertical' | 'horizontal' | 'none';
|
|
29
|
+
x?: number;
|
|
30
|
+
y?: number;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
animation?: boolean;
|
|
33
|
+
id?: string;
|
|
34
|
+
changeThrottleTime?: number;
|
|
35
|
+
bindchange?: (event: unknown) => void;
|
|
36
|
+
bindtouchstart?: (event: GestureTouchEvent) => void;
|
|
37
|
+
catchtouchstart?: (event: GestureTouchEvent) => void;
|
|
38
|
+
bindtouchmove?: (event: GestureTouchEvent) => void;
|
|
39
|
+
catchtouchmove?: (event: GestureTouchEvent) => void;
|
|
40
|
+
catchtouchend?: (event: GestureTouchEvent) => void;
|
|
41
|
+
bindtouchend?: (event: GestureTouchEvent) => void;
|
|
42
|
+
bindhtouchmove?: (event: GestureTouchEvent) => void;
|
|
43
|
+
bindvtouchmove?: (event: GestureTouchEvent) => void;
|
|
44
|
+
catchhtouchmove?: (event: GestureTouchEvent) => void;
|
|
45
|
+
catchvtouchmove?: (event: GestureTouchEvent) => void;
|
|
46
|
+
bindlongpress?: (event: GestureTouchEvent) => void;
|
|
47
|
+
catchlongpress?: (event: GestureTouchEvent) => void;
|
|
48
|
+
bindtap?: (event: GestureTouchEvent) => void;
|
|
49
|
+
catchtap?: (event: GestureTouchEvent) => void;
|
|
50
|
+
onLayout?: (event: LayoutChangeEvent) => void;
|
|
51
|
+
'out-of-bounds'?: boolean;
|
|
52
|
+
'wait-for'?: Array<GestureHandler>;
|
|
53
|
+
'simultaneous-handlers'?: Array<GestureHandler>;
|
|
54
|
+
inertia?: boolean;
|
|
55
|
+
'enable-var'?: boolean;
|
|
56
|
+
'external-var-context'?: Record<string, any>;
|
|
57
|
+
'parent-font-size'?: number;
|
|
58
|
+
'parent-width'?: number;
|
|
59
|
+
'parent-height'?: number;
|
|
60
|
+
'disable-event-passthrough'?: boolean;
|
|
61
|
+
}
|
|
62
|
+
declare const _MovableView: import("react").ForwardRefExoticComponent<MovableViewProps & import("react").RefAttributes<HandlerRef<View, MovableViewProps>>>;
|
|
63
|
+
export default _MovableView;
|
|
@@ -41,7 +41,7 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
|
|
|
41
41
|
const hasLayoutRef = useRef(false);
|
|
42
42
|
const propsRef = useRef({});
|
|
43
43
|
propsRef.current = (props || {});
|
|
44
|
-
const { x = 0, y = 0, inertia = false, disabled = false, animation = true, 'out-of-bounds': outOfBounds = false, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, direction = 'none', 'simultaneous-handlers': originSimultaneousHandlers = [], 'wait-for': waitFor = [], style = {}, changeThrottleTime = 60, bindtouchstart, catchtouchstart, bindhtouchmove, bindvtouchmove, bindtouchmove, catchhtouchmove, catchvtouchmove, catchtouchmove, bindtouchend, catchtouchend, bindchange } = props;
|
|
44
|
+
const { x = 0, y = 0, inertia = false, disabled = false, animation = true, 'out-of-bounds': outOfBounds = false, 'enable-var': enableVar, 'external-var-context': externalVarContext, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, direction = 'none', 'disable-event-passthrough': disableEventPassthrough = false, 'simultaneous-handlers': originSimultaneousHandlers = [], 'wait-for': waitFor = [], style = {}, changeThrottleTime = 60, bindtouchstart, catchtouchstart, bindhtouchmove, bindvtouchmove, bindtouchmove, catchhtouchmove, catchvtouchmove, catchtouchmove, bindtouchend, catchtouchend, bindchange } = props;
|
|
45
45
|
const { hasSelfPercent, normalStyle, hasVarDec, varContextRef, setWidth, setHeight } = useTransformStyle(Object.assign({}, style, styles.container), { enableVar, externalVarContext, parentFontSize, parentWidth, parentHeight });
|
|
46
46
|
const navigation = useNavigation();
|
|
47
47
|
const prevSimultaneousHandlersRef = useRef(originSimultaneousHandlers || []);
|
|
@@ -449,11 +449,13 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
|
|
|
449
449
|
}
|
|
450
450
|
})
|
|
451
451
|
.withRef(movableGestureRef);
|
|
452
|
-
if (
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
452
|
+
if (!disableEventPassthrough) {
|
|
453
|
+
if (direction === 'horizontal') {
|
|
454
|
+
gesturePan.activeOffsetX([-5, 5]).failOffsetY([-5, 5]);
|
|
455
|
+
}
|
|
456
|
+
else if (direction === 'vertical') {
|
|
457
|
+
gesturePan.activeOffsetY([-5, 5]).failOffsetX([-5, 5]);
|
|
458
|
+
}
|
|
457
459
|
}
|
|
458
460
|
if (simultaneousHandlers && simultaneousHandlers.length) {
|
|
459
461
|
gesturePan.simultaneousWithExternalGesture(...simultaneousHandlers);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface MpxNavContainerProps {
|
|
3
|
+
children?: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export default function MpxNavContainer(props: MpxNavContainerProps): import("react").ReactNode;
|
|
6
|
+
export declare function NavSharedProvider({ children }: {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useNavShared } from './useNavShared';
|
|
2
|
+
import { NavSharedContext } from './context';
|
|
3
|
+
import { useLayoutEffect, useMemo, useState } from 'react';
|
|
4
|
+
import { isAndroid } from './utils';
|
|
5
|
+
export default function MpxNavContainer(props) {
|
|
6
|
+
const [, setCustomNav] = useNavShared();
|
|
7
|
+
useLayoutEffect(() => {
|
|
8
|
+
if (!isAndroid)
|
|
9
|
+
return;
|
|
10
|
+
if (props.children) {
|
|
11
|
+
setCustomNav(props.children);
|
|
12
|
+
}
|
|
13
|
+
return () => {
|
|
14
|
+
setCustomNav(undefined);
|
|
15
|
+
};
|
|
16
|
+
}, [props.children]);
|
|
17
|
+
return isAndroid ? null : props.children;
|
|
18
|
+
}
|
|
19
|
+
export function NavSharedProvider({ children }) {
|
|
20
|
+
const [customNav, setCustomNav] = useState();
|
|
21
|
+
const value = useMemo(() => ({ customNav, setCustomNav }), [customNav]);
|
|
22
|
+
return <NavSharedContext.Provider value={value}>{children}</NavSharedContext.Provider>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { _ViewProps } from './mpx-view';
|
|
3
|
+
interface _NavigatorProps extends _ViewProps {
|
|
4
|
+
['open-type']: 'navigate' | 'redirect' | 'switchTab' | 'reLaunch' | 'navigateBack';
|
|
5
|
+
url: string;
|
|
6
|
+
delta: number;
|
|
7
|
+
}
|
|
8
|
+
declare const _Navigator: import("react").ForwardRefExoticComponent<_NavigatorProps & import("react").RefAttributes<any>>;
|
|
9
|
+
export default _Navigator;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
type Position = 'top' | 'bottom' | 'right' | 'center';
|
|
4
|
+
interface PageContainerProps {
|
|
5
|
+
show: boolean;
|
|
6
|
+
duration?: number;
|
|
7
|
+
'z-index'?: number;
|
|
8
|
+
overlay?: boolean;
|
|
9
|
+
position?: Position;
|
|
10
|
+
round?: boolean;
|
|
11
|
+
'close-on-slide-down'?: boolean;
|
|
12
|
+
'overlay-style'?: StyleProp<ViewStyle>;
|
|
13
|
+
'custom-style'?: StyleProp<ViewStyle>;
|
|
14
|
+
bindclose: (event: CustomEvent<{
|
|
15
|
+
value: boolean;
|
|
16
|
+
}>) => void;
|
|
17
|
+
bindbeforeenter?: (event: CustomEvent) => void;
|
|
18
|
+
bindenter?: (event: CustomEvent) => void;
|
|
19
|
+
bindafterenter?: (event: CustomEvent) => void;
|
|
20
|
+
bindbeforeleave?: (event: CustomEvent) => void;
|
|
21
|
+
bindleave?: (event: CustomEvent) => void;
|
|
22
|
+
bindafterleave?: (event: CustomEvent) => void;
|
|
23
|
+
bindclickoverlay?: (event: CustomEvent) => void;
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
}
|
|
26
|
+
declare const _default: React.ForwardRefExoticComponent<PageContainerProps & React.RefAttributes<any>>;
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { createElement, forwardRef, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { StyleSheet, Animated, Dimensions, TouchableWithoutFeedback, PanResponder } from 'react-native';
|
|
3
|
+
import Portal from './mpx-portal/index';
|
|
4
|
+
import { usePreventRemove } from '@react-navigation/native';
|
|
5
|
+
import { extendObject, useLayout, useNavigation } from './utils';
|
|
6
|
+
import useInnerProps, { getCustomEvent } from './getInnerListeners';
|
|
7
|
+
import useNodesRef from './useNodesRef';
|
|
8
|
+
const screenHeight = Dimensions.get('window').height;
|
|
9
|
+
const screenWidth = Dimensions.get('window').width;
|
|
10
|
+
function nextTick(cb) {
|
|
11
|
+
setTimeout(cb, 0);
|
|
12
|
+
}
|
|
13
|
+
export default forwardRef((props, ref) => {
|
|
14
|
+
const { show, duration = 300, 'z-index': zIndex = 100, overlay = true, position = 'bottom', round = false, 'close-on-slide-down': closeOnSlideDown = false, 'overlay-style': overlayStyle, 'custom-style': customStyle, bindclose, // RN下特有属性,用于同步show状态到父组件
|
|
15
|
+
bindbeforeenter, bindenter, bindafterenter, bindbeforeleave, bindleave, bindafterleave, bindclickoverlay, children } = props;
|
|
16
|
+
const isFirstRenderFlag = useRef(true);
|
|
17
|
+
const isFirstRender = isFirstRenderFlag.current;
|
|
18
|
+
if (isFirstRenderFlag.current) {
|
|
19
|
+
isFirstRenderFlag.current = false;
|
|
20
|
+
}
|
|
21
|
+
const close = () => {
|
|
22
|
+
bindclose(getCustomEvent('close', {}, { detail: { value: false, source: 'close' } }, props));
|
|
23
|
+
};
|
|
24
|
+
const [internalVisible, setInternalVisible] = useState(show); // 控制组件是否挂载
|
|
25
|
+
const overlayOpacity = useRef(new Animated.Value(0)).current;
|
|
26
|
+
const contentOpacity = useRef(new Animated.Value(position === 'center' ? 0 : 1)).current;
|
|
27
|
+
const contentTranslate = useRef(new Animated.Value(getInitialPosition())).current;
|
|
28
|
+
const currentAnimation = useRef(null);
|
|
29
|
+
function getInitialPosition() {
|
|
30
|
+
switch (position) {
|
|
31
|
+
case 'top':
|
|
32
|
+
return -screenHeight;
|
|
33
|
+
case 'bottom':
|
|
34
|
+
return screenHeight;
|
|
35
|
+
case 'right':
|
|
36
|
+
return screenWidth;
|
|
37
|
+
case 'center':
|
|
38
|
+
return 0;
|
|
39
|
+
default:
|
|
40
|
+
return screenHeight;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const currentTick = useRef(0);
|
|
44
|
+
function createTick() {
|
|
45
|
+
currentTick.current++;
|
|
46
|
+
console.log('currentTick.current++', currentTick.current);
|
|
47
|
+
const current = currentTick.current;
|
|
48
|
+
return () => {
|
|
49
|
+
console.log('currentTick.current', currentTick.current, 'current', current);
|
|
50
|
+
return currentTick.current === current;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
// 播放入场动画
|
|
54
|
+
const animateIn = () => {
|
|
55
|
+
const isCurrentTick = createTick();
|
|
56
|
+
const animateOutFinish = currentAnimation.current === null;
|
|
57
|
+
if (!animateOutFinish) {
|
|
58
|
+
currentAnimation.current.forEach((animation) => animation.stop());
|
|
59
|
+
}
|
|
60
|
+
const animations = [
|
|
61
|
+
Animated.timing(contentTranslate, {
|
|
62
|
+
toValue: 0,
|
|
63
|
+
duration,
|
|
64
|
+
useNativeDriver: true
|
|
65
|
+
}),
|
|
66
|
+
Animated.timing(contentOpacity, {
|
|
67
|
+
toValue: 1,
|
|
68
|
+
duration,
|
|
69
|
+
useNativeDriver: true
|
|
70
|
+
}),
|
|
71
|
+
Animated.timing(overlayOpacity, {
|
|
72
|
+
toValue: 1,
|
|
73
|
+
duration,
|
|
74
|
+
useNativeDriver: true
|
|
75
|
+
})
|
|
76
|
+
];
|
|
77
|
+
currentAnimation.current = animations;
|
|
78
|
+
// 所有生命周期需相隔一个nextTick以保证在生命周期中修改show可在组件内部监听到
|
|
79
|
+
bindbeforeenter && bindbeforeenter(getCustomEvent('beforeenter', {}, { detail: { value: false, source: 'beforeenter' } }, props));
|
|
80
|
+
nextTick(() => {
|
|
81
|
+
bindenter && bindenter(getCustomEvent('enter', {}, { detail: { value: false, source: 'enter' } }, props));
|
|
82
|
+
// 与微信对其, bindenter 需要执行,所以 isCurrentTick 放在后面
|
|
83
|
+
if (!isCurrentTick())
|
|
84
|
+
return;
|
|
85
|
+
console.log('animateIn start');
|
|
86
|
+
// 设置为动画初始状态(特殊情况, 如果退场动画没有结束 或者 退场动画还未开始,则无需初始化,而是从当前位置完成动画)
|
|
87
|
+
if (animateOutFinish) {
|
|
88
|
+
contentTranslate.setValue(getInitialPosition());
|
|
89
|
+
contentOpacity.setValue(position === 'center' ? 0 : 1);
|
|
90
|
+
}
|
|
91
|
+
Animated.parallel(animations).start(() => {
|
|
92
|
+
bindafterenter && bindafterenter(getCustomEvent('afterenter', {}, { detail: { value: false, source: 'afterenter' } }, props));
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
// 播放离场动画
|
|
97
|
+
const animateOut = () => {
|
|
98
|
+
const isCurrentTick = createTick();
|
|
99
|
+
// 停止入场动画
|
|
100
|
+
currentAnimation.current?.forEach((animation) => animation.stop());
|
|
101
|
+
const animations = [Animated.timing(overlayOpacity, {
|
|
102
|
+
toValue: 0,
|
|
103
|
+
duration,
|
|
104
|
+
useNativeDriver: true
|
|
105
|
+
})
|
|
106
|
+
];
|
|
107
|
+
if (position === 'center') {
|
|
108
|
+
animations.push(Animated.timing(contentOpacity, {
|
|
109
|
+
toValue: 0,
|
|
110
|
+
duration,
|
|
111
|
+
useNativeDriver: true
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
animations.push(Animated.timing(contentTranslate, {
|
|
116
|
+
toValue: getInitialPosition(),
|
|
117
|
+
duration,
|
|
118
|
+
useNativeDriver: true
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
currentAnimation.current = animations;
|
|
122
|
+
bindbeforeleave && bindbeforeleave(getCustomEvent('beforeleave', {}, { detail: { value: false, source: 'beforeleave' } }, props));
|
|
123
|
+
nextTick(() => {
|
|
124
|
+
bindleave && bindleave(getCustomEvent('leave', {}, { detail: { value: false, source: 'leave' } }, props));
|
|
125
|
+
if (!isCurrentTick())
|
|
126
|
+
return;
|
|
127
|
+
console.log('animateOut start');
|
|
128
|
+
Animated.parallel(animations).start(() => {
|
|
129
|
+
currentAnimation.current = null;
|
|
130
|
+
bindafterleave && bindafterleave(getCustomEvent('afterleave', {}, { detail: { value: false, source: 'afterleave' } }, props));
|
|
131
|
+
setInternalVisible(false); // 动画播放完后,才卸载
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
console.log('====comp show', show, 'internalVisible', internalVisible);
|
|
137
|
+
// 如果展示状态和挂载状态一致,则不需要做任何操作
|
|
138
|
+
if (show) {
|
|
139
|
+
setInternalVisible(true); // 确保挂载
|
|
140
|
+
animateIn();
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
if (!isFirstRender)
|
|
144
|
+
animateOut();
|
|
145
|
+
}
|
|
146
|
+
}, [show]);
|
|
147
|
+
const navigation = useNavigation();
|
|
148
|
+
usePreventRemove(show, (event) => {
|
|
149
|
+
const { data } = event;
|
|
150
|
+
if (show) {
|
|
151
|
+
close();
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
navigation?.dispatch(data.action);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
// IOS 下需要关闭手势返回(原因: IOS手势返回时页面会跟随手指滑动,但是实际返回动作是在松手时触发,需禁掉页面跟随手指滑动的效果)
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
navigation?.setOptions({
|
|
160
|
+
gestureEnabled: !show
|
|
161
|
+
});
|
|
162
|
+
}, [show]);
|
|
163
|
+
const SCREEN_EDGE_THRESHOLD = 60; // 从屏幕左侧 30px 内触发
|
|
164
|
+
// 内容区 手势下滑关闭
|
|
165
|
+
const contentPanResponder = PanResponder.create({
|
|
166
|
+
onMoveShouldSetPanResponder: (_, gestureState) => {
|
|
167
|
+
const { dx, dy } = gestureState;
|
|
168
|
+
return dy > 200 && Math.abs(dx) < 60;
|
|
169
|
+
},
|
|
170
|
+
onPanResponderRelease: () => {
|
|
171
|
+
close();
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
// 全屏幕 IOS 右滑手势返回
|
|
175
|
+
const screenPanResponder = PanResponder.create({
|
|
176
|
+
onMoveShouldSetPanResponder: (_, gestureState) => {
|
|
177
|
+
const { moveX, dx, dy } = gestureState;
|
|
178
|
+
const isFromEdge = moveX < SCREEN_EDGE_THRESHOLD;
|
|
179
|
+
const isHorizontalSwipe = dx > 10 && Math.abs(dy) < 20;
|
|
180
|
+
return isFromEdge && isHorizontalSwipe;
|
|
181
|
+
},
|
|
182
|
+
onPanResponderRelease: (_, gestureState) => {
|
|
183
|
+
if (gestureState.dx > 100) {
|
|
184
|
+
close();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
const getTransformStyle = () => {
|
|
189
|
+
switch (position) {
|
|
190
|
+
case 'top':
|
|
191
|
+
case 'bottom':
|
|
192
|
+
return { transform: [{ translateY: contentTranslate }] };
|
|
193
|
+
case 'right':
|
|
194
|
+
return { transform: [{ translateX: contentTranslate }] };
|
|
195
|
+
case 'center':
|
|
196
|
+
return {};
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
const renderMask = () => {
|
|
200
|
+
const onPress = () => {
|
|
201
|
+
close();
|
|
202
|
+
bindclickoverlay && bindclickoverlay(getCustomEvent('clickoverlay', {}, { detail: { value: false, source: 'clickoverlay' } }, props));
|
|
203
|
+
};
|
|
204
|
+
return createElement(TouchableWithoutFeedback, { onPress }, createElement(Animated.View, { style: [styles.overlay, overlayStyle, { opacity: overlayOpacity }] }));
|
|
205
|
+
};
|
|
206
|
+
const renderContent = (children) => {
|
|
207
|
+
const contentProps = extendObject({
|
|
208
|
+
style: [
|
|
209
|
+
styles.container,
|
|
210
|
+
round ? styles.rounded : null,
|
|
211
|
+
positionStyle[position],
|
|
212
|
+
customStyle,
|
|
213
|
+
getTransformStyle(),
|
|
214
|
+
{ opacity: contentOpacity }
|
|
215
|
+
]
|
|
216
|
+
}, closeOnSlideDown ? contentPanResponder.panHandlers : null);
|
|
217
|
+
return createElement(Animated.View, contentProps, children);
|
|
218
|
+
};
|
|
219
|
+
const nodeRef = useRef(null);
|
|
220
|
+
useNodesRef(props, ref, nodeRef, {});
|
|
221
|
+
const { layoutRef, layoutProps } = useLayout({ props, hasSelfPercent: false, nodeRef });
|
|
222
|
+
const innerProps = useInnerProps(extendObject({}, props, {
|
|
223
|
+
ref: nodeRef
|
|
224
|
+
}, layoutProps), [], { layoutRef });
|
|
225
|
+
const wrapperProps = extendObject(innerProps, {
|
|
226
|
+
style: [styles.wrapper, { zIndex }]
|
|
227
|
+
}, __mpx_mode__ === 'ios' ? screenPanResponder.panHandlers : {});
|
|
228
|
+
// TODO 是否有必要支持refs? dataset?
|
|
229
|
+
return createElement(Portal, null, internalVisible
|
|
230
|
+
? createElement(Animated.View, wrapperProps, overlay ? renderMask() : null, renderContent(children))
|
|
231
|
+
: null);
|
|
232
|
+
});
|
|
233
|
+
const styles = StyleSheet.create({
|
|
234
|
+
wrapper: extendObject({
|
|
235
|
+
justifyContent: 'flex-end',
|
|
236
|
+
alignItems: 'center'
|
|
237
|
+
}, StyleSheet.absoluteFillObject),
|
|
238
|
+
overlay: extendObject({
|
|
239
|
+
backgroundColor: 'rgba(0,0,0,0.5)'
|
|
240
|
+
}, StyleSheet.absoluteFillObject),
|
|
241
|
+
container: {
|
|
242
|
+
position: 'absolute',
|
|
243
|
+
backgroundColor: 'white'
|
|
244
|
+
},
|
|
245
|
+
rounded: {
|
|
246
|
+
borderTopLeftRadius: 20,
|
|
247
|
+
borderTopRightRadius: 20
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
const positionStyle = {
|
|
251
|
+
bottom: { bottom: 0, width: '100%', height: 'auto' },
|
|
252
|
+
top: { top: 0, width: '100%', height: 'auto' },
|
|
253
|
+
right: extendObject({}, StyleSheet.absoluteFillObject, { right: 0 }),
|
|
254
|
+
center: extendObject({}, StyleSheet.absoluteFillObject)
|
|
255
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { DateProps } from './type';
|
|
4
|
+
import { HandlerRef } from '../useNodesRef';
|
|
5
|
+
declare const PickerDate: React.ForwardRefExoticComponent<Omit<DateProps, "ref"> & React.RefAttributes<HandlerRef<View, DateProps>>>;
|
|
6
|
+
export default PickerDate;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const wrapDate: (union?: string) => (num: number) => string;
|
|
2
|
+
export declare const START_YEAR = 1900;
|
|
3
|
+
export declare const END_YEAR = 2099;
|
|
4
|
+
export declare const years: string[];
|
|
5
|
+
export declare const months: string[];
|
|
6
|
+
export declare const daysInMonthLength: (year: number, month: number) => 30 | 28 | 29 | 31;
|
|
7
|
+
export declare const daysInMonth: (year: number, month: number) => string[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { HandlerRef } from '../useNodesRef';
|
|
4
|
+
import { PickerProps } from './type';
|
|
5
|
+
declare const Picker: React.ForwardRefExoticComponent<(Omit<import("./type").DateProps, "ref"> | Omit<import("./type").SelectorProps, "ref"> | Omit<import("./type").MultiSelectorProps, "ref"> | Omit<import("./type").TimeProps, "ref"> | Omit<import("./type").RegionProps, "ref">) & React.RefAttributes<HandlerRef<View, PickerProps>>>;
|
|
6
|
+
export default Picker;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { MultiSelectorProps } from './type';
|
|
4
|
+
import { HandlerRef } from '../useNodesRef';
|
|
5
|
+
declare const PickerMultiSelector: React.ForwardRefExoticComponent<Omit<MultiSelectorProps, "ref"> & React.RefAttributes<HandlerRef<View, MultiSelectorProps>>>;
|
|
6
|
+
export default PickerMultiSelector;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { RegionProps } from './type';
|
|
4
|
+
import { HandlerRef } from '../useNodesRef';
|
|
5
|
+
declare const PickerRegion: React.ForwardRefExoticComponent<Omit<RegionProps, "ref"> & React.RefAttributes<HandlerRef<View, RegionProps>>>;
|
|
6
|
+
export default PickerRegion;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { SelectorProps } from './type';
|
|
4
|
+
import { HandlerRef } from '../useNodesRef';
|
|
5
|
+
declare const PickerSelector: React.ForwardRefExoticComponent<Omit<SelectorProps, "ref"> & React.RefAttributes<HandlerRef<View, SelectorProps>>>;
|
|
6
|
+
export default PickerSelector;
|