@xaui/native 0.2.8 → 0.9.1-alpha.0
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/dist/chunk-JDS6KGCM.cjs +791 -0
- package/dist/chunk-T3ZI2PZ6.js +791 -0
- package/dist/index.cjs +32 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +32 -0
- package/dist/theme/index.cjs +32 -0
- package/dist/theme/index.d.cts +669 -0
- package/dist/theme/index.d.ts +669 -0
- package/dist/theme/index.js +32 -0
- package/package.json +26 -249
- package/README.md +0 -178
- package/dist/alert/index.cjs +0 -340
- package/dist/alert/index.d.cts +0 -46
- package/dist/alert/index.d.ts +0 -46
- package/dist/alert/index.js +0 -340
- package/dist/app-bar/index.cjs +0 -148
- package/dist/app-bar/index.d.cts +0 -59
- package/dist/app-bar/index.d.ts +0 -59
- package/dist/app-bar/index.js +0 -148
- package/dist/autocomplete/index.cjs +0 -1122
- package/dist/autocomplete/index.d.cts +0 -88
- package/dist/autocomplete/index.d.ts +0 -88
- package/dist/autocomplete/index.js +0 -1122
- package/dist/avatar/index.cjs +0 -281
- package/dist/avatar/index.d.cts +0 -123
- package/dist/avatar/index.d.ts +0 -123
- package/dist/avatar/index.js +0 -281
- package/dist/badge/index.cjs +0 -197
- package/dist/badge/index.d.cts +0 -94
- package/dist/badge/index.d.ts +0 -94
- package/dist/badge/index.js +0 -197
- package/dist/bottom-sheet/index.cjs +0 -9
- package/dist/bottom-sheet/index.d.cts +0 -84
- package/dist/bottom-sheet/index.d.ts +0 -84
- package/dist/bottom-sheet/index.js +0 -9
- package/dist/bottom-tab-bar/index.cjs +0 -497
- package/dist/bottom-tab-bar/index.d.cts +0 -211
- package/dist/bottom-tab-bar/index.d.ts +0 -211
- package/dist/bottom-tab-bar/index.js +0 -497
- package/dist/button/index.cjs +0 -392
- package/dist/button/index.d.cts +0 -174
- package/dist/button/index.d.ts +0 -174
- package/dist/button/index.js +0 -392
- package/dist/button.type-j1ZdkkSl.d.cts +0 -4
- package/dist/button.type-j1ZdkkSl.d.ts +0 -4
- package/dist/card/index.cjs +0 -338
- package/dist/card/index.d.cts +0 -191
- package/dist/card/index.d.ts +0 -191
- package/dist/card/index.js +0 -338
- package/dist/carousel/index.cjs +0 -381
- package/dist/carousel/index.d.cts +0 -147
- package/dist/carousel/index.d.ts +0 -147
- package/dist/carousel/index.js +0 -381
- package/dist/chart/index.cjs +0 -1026
- package/dist/chart/index.d.cts +0 -218
- package/dist/chart/index.d.ts +0 -218
- package/dist/chart/index.js +0 -1026
- package/dist/checkbox/index.cjs +0 -443
- package/dist/checkbox/index.d.cts +0 -73
- package/dist/checkbox/index.d.ts +0 -73
- package/dist/checkbox/index.js +0 -443
- package/dist/chip/index.cjs +0 -503
- package/dist/chip/index.d.cts +0 -195
- package/dist/chip/index.d.ts +0 -195
- package/dist/chip/index.js +0 -503
- package/dist/chunk-4JFWQ5XT.js +0 -368
- package/dist/chunk-56RPWZD2.cjs +0 -9
- package/dist/chunk-7UFBLUMV.cjs +0 -136
- package/dist/chunk-A45TVXU5.js +0 -337
- package/dist/chunk-BYWUAPC4.cjs +0 -368
- package/dist/chunk-DECMUMCI.js +0 -0
- package/dist/chunk-DHSTKO3K.cjs +0 -19
- package/dist/chunk-DJ4Q37UT.cjs +0 -75
- package/dist/chunk-EUQDGTST.cjs +0 -1
- package/dist/chunk-GBHQCAKW.js +0 -19
- package/dist/chunk-RBSA4NH4.js +0 -136
- package/dist/chunk-SHBDANQN.js +0 -9
- package/dist/chunk-UGEINZM7.cjs +0 -290
- package/dist/chunk-UU4HHBDN.js +0 -290
- package/dist/chunk-VSZEXOUN.js +0 -384
- package/dist/chunk-YIEUN3G5.cjs +0 -384
- package/dist/chunk-ZH6ZSV2Q.cjs +0 -337
- package/dist/chunk-ZY7IUTAT.js +0 -75
- package/dist/color-picker/index.cjs +0 -457
- package/dist/color-picker/index.d.cts +0 -124
- package/dist/color-picker/index.d.ts +0 -124
- package/dist/color-picker/index.js +0 -457
- package/dist/core/index.cjs +0 -24
- package/dist/core/index.d.cts +0 -28
- package/dist/core/index.d.ts +0 -28
- package/dist/core/index.js +0 -24
- package/dist/datepicker/index.cjs +0 -1625
- package/dist/datepicker/index.d.cts +0 -45
- package/dist/datepicker/index.d.ts +0 -45
- package/dist/datepicker/index.js +0 -1625
- package/dist/dialog/index.cjs +0 -372
- package/dist/dialog/index.d.cts +0 -151
- package/dist/dialog/index.d.ts +0 -151
- package/dist/dialog/index.js +0 -372
- package/dist/divider/index.cjs +0 -8
- package/dist/divider/index.d.cts +0 -30
- package/dist/divider/index.d.ts +0 -30
- package/dist/divider/index.js +0 -8
- package/dist/drawer/index.cjs +0 -237
- package/dist/drawer/index.d.cts +0 -58
- package/dist/drawer/index.d.ts +0 -58
- package/dist/drawer/index.js +0 -237
- package/dist/expansion-panel/index.cjs +0 -441
- package/dist/expansion-panel/index.d.cts +0 -153
- package/dist/expansion-panel/index.d.ts +0 -153
- package/dist/expansion-panel/index.js +0 -441
- package/dist/fab/index.cjs +0 -9
- package/dist/fab/index.d.cts +0 -10
- package/dist/fab/index.d.ts +0 -10
- package/dist/fab/index.js +0 -9
- package/dist/fab-menu/index.cjs +0 -330
- package/dist/fab-menu/index.d.cts +0 -125
- package/dist/fab-menu/index.d.ts +0 -125
- package/dist/fab-menu/index.js +0 -330
- package/dist/fab.type-CkUHmXU_.d.ts +0 -86
- package/dist/fab.type-DN0vtAh6.d.cts +0 -86
- package/dist/feature-discovery/index.cjs +0 -464
- package/dist/feature-discovery/index.d.cts +0 -82
- package/dist/feature-discovery/index.d.ts +0 -82
- package/dist/feature-discovery/index.js +0 -464
- package/dist/indicator/index.cjs +0 -8
- package/dist/indicator/index.d.cts +0 -47
- package/dist/indicator/index.d.ts +0 -47
- package/dist/indicator/index.js +0 -8
- package/dist/input/index.cjs +0 -1462
- package/dist/input/index.d.cts +0 -522
- package/dist/input/index.d.ts +0 -522
- package/dist/input/index.js +0 -1462
- package/dist/input-trigger/index.cjs +0 -197
- package/dist/input-trigger/index.d.cts +0 -11
- package/dist/input-trigger/index.d.ts +0 -11
- package/dist/input-trigger/index.js +0 -197
- package/dist/input-trigger.type-Ba4bM3Qp.d.cts +0 -180
- package/dist/input-trigger.type-Ba4bM3Qp.d.ts +0 -180
- package/dist/list/index.cjs +0 -395
- package/dist/list/index.d.cts +0 -188
- package/dist/list/index.d.ts +0 -188
- package/dist/list/index.js +0 -395
- package/dist/menu/index.cjs +0 -316
- package/dist/menu/index.d.cts +0 -115
- package/dist/menu/index.d.ts +0 -115
- package/dist/menu/index.js +0 -316
- package/dist/menubox/index.cjs +0 -297
- package/dist/menubox/index.d.cts +0 -98
- package/dist/menubox/index.d.ts +0 -98
- package/dist/menubox/index.js +0 -297
- package/dist/pager/index.cjs +0 -205
- package/dist/pager/index.d.cts +0 -93
- package/dist/pager/index.d.ts +0 -93
- package/dist/pager/index.js +0 -205
- package/dist/picker/index.cjs +0 -244
- package/dist/picker/index.d.cts +0 -121
- package/dist/picker/index.d.ts +0 -121
- package/dist/picker/index.js +0 -244
- package/dist/progress/index.cjs +0 -219
- package/dist/progress/index.d.cts +0 -47
- package/dist/progress/index.d.ts +0 -47
- package/dist/progress/index.js +0 -219
- package/dist/radio/index.cjs +0 -465
- package/dist/radio/index.d.cts +0 -145
- package/dist/radio/index.d.ts +0 -145
- package/dist/radio/index.js +0 -465
- package/dist/refresh-control/index.cjs +0 -45
- package/dist/refresh-control/index.d.cts +0 -55
- package/dist/refresh-control/index.d.ts +0 -55
- package/dist/refresh-control/index.js +0 -45
- package/dist/segment-button/index.cjs +0 -405
- package/dist/segment-button/index.d.cts +0 -141
- package/dist/segment-button/index.d.ts +0 -141
- package/dist/segment-button/index.js +0 -405
- package/dist/select/index.cjs +0 -878
- package/dist/select/index.d.cts +0 -192
- package/dist/select/index.d.ts +0 -192
- package/dist/select/index.js +0 -878
- package/dist/skeleton/index.cjs +0 -89
- package/dist/skeleton/index.d.cts +0 -45
- package/dist/skeleton/index.d.ts +0 -45
- package/dist/skeleton/index.js +0 -89
- package/dist/slider/index.cjs +0 -576
- package/dist/slider/index.d.cts +0 -171
- package/dist/slider/index.d.ts +0 -171
- package/dist/slider/index.js +0 -576
- package/dist/snackbar/index.cjs +0 -436
- package/dist/snackbar/index.d.cts +0 -174
- package/dist/snackbar/index.d.ts +0 -174
- package/dist/snackbar/index.js +0 -436
- package/dist/snippet/index.cjs +0 -314
- package/dist/snippet/index.d.cts +0 -95
- package/dist/snippet/index.d.ts +0 -95
- package/dist/snippet/index.js +0 -314
- package/dist/stepper/index.cjs +0 -550
- package/dist/stepper/index.d.cts +0 -137
- package/dist/stepper/index.d.ts +0 -137
- package/dist/stepper/index.js +0 -550
- package/dist/switch/index.cjs +0 -358
- package/dist/switch/index.d.cts +0 -28
- package/dist/switch/index.d.ts +0 -28
- package/dist/switch/index.js +0 -358
- package/dist/tabs/index.cjs +0 -440
- package/dist/tabs/index.d.cts +0 -180
- package/dist/tabs/index.d.ts +0 -180
- package/dist/tabs/index.js +0 -440
- package/dist/timepicker/index.cjs +0 -823
- package/dist/timepicker/index.d.cts +0 -215
- package/dist/timepicker/index.d.ts +0 -215
- package/dist/timepicker/index.js +0 -823
- package/dist/toolbar/index.cjs +0 -333
- package/dist/toolbar/index.d.cts +0 -100
- package/dist/toolbar/index.d.ts +0 -100
- package/dist/toolbar/index.js +0 -333
- package/dist/typography/index.cjs +0 -238
- package/dist/typography/index.d.cts +0 -113
- package/dist/typography/index.d.ts +0 -113
- package/dist/typography/index.js +0 -238
- package/dist/view/index.cjs +0 -1361
- package/dist/view/index.d.cts +0 -833
- package/dist/view/index.d.ts +0 -833
- package/dist/view/index.js +0 -1361
package/dist/drawer/index.d.cts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { ViewStyle } from 'react-native';
|
|
3
|
-
import { ThemeColor } from '@xaui/core/types';
|
|
4
|
-
|
|
5
|
-
type DrawerPosition = 'top' | 'left' | 'bottom' | 'right';
|
|
6
|
-
type DrawerProps = {
|
|
7
|
-
/**
|
|
8
|
-
* Content to render inside the drawer.
|
|
9
|
-
*/
|
|
10
|
-
children: ReactNode;
|
|
11
|
-
/**
|
|
12
|
-
* Whether the drawer is visible.
|
|
13
|
-
* @default false
|
|
14
|
-
*/
|
|
15
|
-
isOpen: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Position of the drawer.
|
|
18
|
-
* @default 'left'
|
|
19
|
-
*/
|
|
20
|
-
position?: DrawerPosition;
|
|
21
|
-
/**
|
|
22
|
-
* The theme color of the drawer.
|
|
23
|
-
* @default 'default'
|
|
24
|
-
*/
|
|
25
|
-
themeColor?: ThemeColor;
|
|
26
|
-
/**
|
|
27
|
-
* Width of the drawer (for left/right position).
|
|
28
|
-
* @default 280
|
|
29
|
-
*/
|
|
30
|
-
width?: number;
|
|
31
|
-
/**
|
|
32
|
-
* Height of the drawer (for top/bottom position).
|
|
33
|
-
* @default 280
|
|
34
|
-
*/
|
|
35
|
-
height?: number;
|
|
36
|
-
/**
|
|
37
|
-
* Whether to show overlay backdrop.
|
|
38
|
-
* @default true
|
|
39
|
-
*/
|
|
40
|
-
showOverlay?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Callback fired when drawer should close (overlay tap or back button).
|
|
43
|
-
*/
|
|
44
|
-
onClose?: () => void;
|
|
45
|
-
/**
|
|
46
|
-
* Custom styles for the drawer container.
|
|
47
|
-
*/
|
|
48
|
-
customStyle?: ViewStyle;
|
|
49
|
-
/**
|
|
50
|
-
* Disable slide animation.
|
|
51
|
-
* @default false
|
|
52
|
-
*/
|
|
53
|
-
disableAnimation?: boolean;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
declare const Drawer: React.FC<DrawerProps>;
|
|
57
|
-
|
|
58
|
-
export { Drawer, type DrawerPosition, type DrawerProps };
|
package/dist/drawer/index.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
import { ViewStyle } from 'react-native';
|
|
3
|
-
import { ThemeColor } from '@xaui/core/types';
|
|
4
|
-
|
|
5
|
-
type DrawerPosition = 'top' | 'left' | 'bottom' | 'right';
|
|
6
|
-
type DrawerProps = {
|
|
7
|
-
/**
|
|
8
|
-
* Content to render inside the drawer.
|
|
9
|
-
*/
|
|
10
|
-
children: ReactNode;
|
|
11
|
-
/**
|
|
12
|
-
* Whether the drawer is visible.
|
|
13
|
-
* @default false
|
|
14
|
-
*/
|
|
15
|
-
isOpen: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Position of the drawer.
|
|
18
|
-
* @default 'left'
|
|
19
|
-
*/
|
|
20
|
-
position?: DrawerPosition;
|
|
21
|
-
/**
|
|
22
|
-
* The theme color of the drawer.
|
|
23
|
-
* @default 'default'
|
|
24
|
-
*/
|
|
25
|
-
themeColor?: ThemeColor;
|
|
26
|
-
/**
|
|
27
|
-
* Width of the drawer (for left/right position).
|
|
28
|
-
* @default 280
|
|
29
|
-
*/
|
|
30
|
-
width?: number;
|
|
31
|
-
/**
|
|
32
|
-
* Height of the drawer (for top/bottom position).
|
|
33
|
-
* @default 280
|
|
34
|
-
*/
|
|
35
|
-
height?: number;
|
|
36
|
-
/**
|
|
37
|
-
* Whether to show overlay backdrop.
|
|
38
|
-
* @default true
|
|
39
|
-
*/
|
|
40
|
-
showOverlay?: boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Callback fired when drawer should close (overlay tap or back button).
|
|
43
|
-
*/
|
|
44
|
-
onClose?: () => void;
|
|
45
|
-
/**
|
|
46
|
-
* Custom styles for the drawer container.
|
|
47
|
-
*/
|
|
48
|
-
customStyle?: ViewStyle;
|
|
49
|
-
/**
|
|
50
|
-
* Disable slide animation.
|
|
51
|
-
* @default false
|
|
52
|
-
*/
|
|
53
|
-
disableAnimation?: boolean;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
declare const Drawer: React.FC<DrawerProps>;
|
|
57
|
-
|
|
58
|
-
export { Drawer, type DrawerPosition, type DrawerProps };
|
package/dist/drawer/index.js
DELETED
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import "../chunk-SHBDANQN.js";
|
|
2
|
-
import {
|
|
3
|
-
useXUITheme
|
|
4
|
-
} from "../chunk-RBSA4NH4.js";
|
|
5
|
-
|
|
6
|
-
// src/components/drawer/drawer.tsx
|
|
7
|
-
import React, { useEffect, useMemo as useMemo2, useRef, useState } from "react";
|
|
8
|
-
import { Animated, Easing, Modal, Pressable, View } from "react-native";
|
|
9
|
-
|
|
10
|
-
// src/components/drawer/drawer.hook.ts
|
|
11
|
-
import { useMemo } from "react";
|
|
12
|
-
import { getSafeThemeColor } from "@xaui/core";
|
|
13
|
-
var useDrawerStyles = (themeColor, position, width, height) => {
|
|
14
|
-
const theme = useXUITheme();
|
|
15
|
-
return useMemo(() => {
|
|
16
|
-
const safeThemeColor = getSafeThemeColor(themeColor);
|
|
17
|
-
const colorScheme = theme.colors[safeThemeColor];
|
|
18
|
-
const isDefaultThemeColor = safeThemeColor === "default";
|
|
19
|
-
const defaultBackgroundColor = theme.mode === "dark" ? theme.colors.default.container : "#FFFFFF";
|
|
20
|
-
const backgroundColor = isDefaultThemeColor ? defaultBackgroundColor : colorScheme.container;
|
|
21
|
-
const sizeStyle = position === "left" || position === "right" ? { width } : { height };
|
|
22
|
-
return {
|
|
23
|
-
backgroundColor,
|
|
24
|
-
...sizeStyle
|
|
25
|
-
};
|
|
26
|
-
}, [height, position, theme, themeColor, width]);
|
|
27
|
-
};
|
|
28
|
-
var getTranslateValue = (position, size) => {
|
|
29
|
-
switch (position) {
|
|
30
|
-
case "left":
|
|
31
|
-
return { x: -size, y: 0 };
|
|
32
|
-
case "right":
|
|
33
|
-
return { x: size, y: 0 };
|
|
34
|
-
case "top":
|
|
35
|
-
return { x: 0, y: -size };
|
|
36
|
-
case "bottom":
|
|
37
|
-
return { x: 0, y: size };
|
|
38
|
-
default:
|
|
39
|
-
return { x: -size, y: 0 };
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// src/components/drawer/drawer.style.ts
|
|
44
|
-
import { StyleSheet } from "react-native";
|
|
45
|
-
var styles = StyleSheet.create({
|
|
46
|
-
overlay: {
|
|
47
|
-
position: "absolute",
|
|
48
|
-
top: 0,
|
|
49
|
-
left: 0,
|
|
50
|
-
right: 0,
|
|
51
|
-
bottom: 0,
|
|
52
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)"
|
|
53
|
-
},
|
|
54
|
-
drawerContainer: {
|
|
55
|
-
position: "absolute",
|
|
56
|
-
backgroundColor: "#ffffff"
|
|
57
|
-
},
|
|
58
|
-
drawerLeft: {
|
|
59
|
-
top: 0,
|
|
60
|
-
left: 0,
|
|
61
|
-
bottom: 0
|
|
62
|
-
},
|
|
63
|
-
drawerRight: {
|
|
64
|
-
top: 0,
|
|
65
|
-
right: 0,
|
|
66
|
-
bottom: 0
|
|
67
|
-
},
|
|
68
|
-
drawerTop: {
|
|
69
|
-
top: 0,
|
|
70
|
-
left: 0,
|
|
71
|
-
right: 0
|
|
72
|
-
},
|
|
73
|
-
drawerBottom: {
|
|
74
|
-
bottom: 0,
|
|
75
|
-
left: 0,
|
|
76
|
-
right: 0
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// src/components/drawer/drawer.tsx
|
|
81
|
-
var Drawer = ({
|
|
82
|
-
children,
|
|
83
|
-
isOpen,
|
|
84
|
-
position = "left",
|
|
85
|
-
themeColor = "default",
|
|
86
|
-
width = 280,
|
|
87
|
-
height = 280,
|
|
88
|
-
showOverlay = true,
|
|
89
|
-
onClose,
|
|
90
|
-
customStyle,
|
|
91
|
-
disableAnimation = false
|
|
92
|
-
}) => {
|
|
93
|
-
const DRAWER_ANIMATION_DURATION = 250;
|
|
94
|
-
const [isModalMounted, setIsModalMounted] = useState(false);
|
|
95
|
-
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
96
|
-
const isModalMountedRef = useRef(false);
|
|
97
|
-
const animationRef = useRef(null);
|
|
98
|
-
const size = position === "left" || position === "right" ? width : height;
|
|
99
|
-
const initialTranslateValues = useMemo2(
|
|
100
|
-
() => getTranslateValue(position, size),
|
|
101
|
-
[position, size]
|
|
102
|
-
);
|
|
103
|
-
const translateX = useRef(new Animated.Value(initialTranslateValues.x)).current;
|
|
104
|
-
const translateY = useRef(new Animated.Value(initialTranslateValues.y)).current;
|
|
105
|
-
const overlayOpacity = useRef(new Animated.Value(0)).current;
|
|
106
|
-
const containerStyle = useDrawerStyles(themeColor, position, width, height);
|
|
107
|
-
const positionStyle = position === "left" ? styles.drawerLeft : position === "right" ? styles.drawerRight : position === "top" ? styles.drawerTop : styles.drawerBottom;
|
|
108
|
-
useEffect(() => {
|
|
109
|
-
const translateValues = getTranslateValue(position, size);
|
|
110
|
-
if (animationRef.current) {
|
|
111
|
-
animationRef.current.stop();
|
|
112
|
-
animationRef.current = null;
|
|
113
|
-
}
|
|
114
|
-
if (isOpen) {
|
|
115
|
-
if (!isModalMountedRef.current) {
|
|
116
|
-
translateX.setValue(translateValues.x);
|
|
117
|
-
translateY.setValue(translateValues.y);
|
|
118
|
-
overlayOpacity.setValue(0);
|
|
119
|
-
isModalMountedRef.current = true;
|
|
120
|
-
setIsModalMounted(true);
|
|
121
|
-
setIsModalVisible(true);
|
|
122
|
-
}
|
|
123
|
-
if (disableAnimation) {
|
|
124
|
-
translateX.setValue(0);
|
|
125
|
-
translateY.setValue(0);
|
|
126
|
-
overlayOpacity.setValue(1);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
const animation2 = Animated.parallel([
|
|
130
|
-
Animated.timing(translateX, {
|
|
131
|
-
toValue: 0,
|
|
132
|
-
duration: DRAWER_ANIMATION_DURATION,
|
|
133
|
-
easing: Easing.out(Easing.cubic),
|
|
134
|
-
useNativeDriver: true
|
|
135
|
-
}),
|
|
136
|
-
Animated.timing(translateY, {
|
|
137
|
-
toValue: 0,
|
|
138
|
-
duration: DRAWER_ANIMATION_DURATION,
|
|
139
|
-
easing: Easing.out(Easing.cubic),
|
|
140
|
-
useNativeDriver: true
|
|
141
|
-
}),
|
|
142
|
-
Animated.timing(overlayOpacity, {
|
|
143
|
-
toValue: 1,
|
|
144
|
-
duration: DRAWER_ANIMATION_DURATION,
|
|
145
|
-
useNativeDriver: true
|
|
146
|
-
})
|
|
147
|
-
]);
|
|
148
|
-
animationRef.current = animation2;
|
|
149
|
-
animation2.start(() => {
|
|
150
|
-
if (animationRef.current === animation2) {
|
|
151
|
-
animationRef.current = null;
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
if (!isModalMountedRef.current) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
if (disableAnimation) {
|
|
160
|
-
translateX.setValue(translateValues.x);
|
|
161
|
-
translateY.setValue(translateValues.y);
|
|
162
|
-
overlayOpacity.setValue(0);
|
|
163
|
-
isModalMountedRef.current = false;
|
|
164
|
-
setIsModalVisible(false);
|
|
165
|
-
setIsModalMounted(false);
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
const animation = Animated.parallel([
|
|
169
|
-
Animated.timing(translateX, {
|
|
170
|
-
toValue: translateValues.x,
|
|
171
|
-
duration: DRAWER_ANIMATION_DURATION,
|
|
172
|
-
easing: Easing.in(Easing.cubic),
|
|
173
|
-
useNativeDriver: true
|
|
174
|
-
}),
|
|
175
|
-
Animated.timing(translateY, {
|
|
176
|
-
toValue: translateValues.y,
|
|
177
|
-
duration: DRAWER_ANIMATION_DURATION,
|
|
178
|
-
easing: Easing.in(Easing.cubic),
|
|
179
|
-
useNativeDriver: true
|
|
180
|
-
}),
|
|
181
|
-
Animated.timing(overlayOpacity, {
|
|
182
|
-
toValue: 0,
|
|
183
|
-
duration: DRAWER_ANIMATION_DURATION,
|
|
184
|
-
useNativeDriver: true
|
|
185
|
-
})
|
|
186
|
-
]);
|
|
187
|
-
animationRef.current = animation;
|
|
188
|
-
animation.start(({ finished }) => {
|
|
189
|
-
if (animationRef.current === animation) {
|
|
190
|
-
animationRef.current = null;
|
|
191
|
-
}
|
|
192
|
-
if (finished) {
|
|
193
|
-
isModalMountedRef.current = false;
|
|
194
|
-
setIsModalVisible(false);
|
|
195
|
-
setIsModalMounted(false);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
}, [
|
|
199
|
-
isOpen,
|
|
200
|
-
position,
|
|
201
|
-
size,
|
|
202
|
-
disableAnimation,
|
|
203
|
-
translateX,
|
|
204
|
-
translateY,
|
|
205
|
-
overlayOpacity
|
|
206
|
-
]);
|
|
207
|
-
if (!isModalMounted) {
|
|
208
|
-
return null;
|
|
209
|
-
}
|
|
210
|
-
return /* @__PURE__ */ React.createElement(
|
|
211
|
-
Modal,
|
|
212
|
-
{
|
|
213
|
-
transparent: true,
|
|
214
|
-
visible: isModalVisible,
|
|
215
|
-
animationType: "none",
|
|
216
|
-
onRequestClose: onClose
|
|
217
|
-
},
|
|
218
|
-
/* @__PURE__ */ React.createElement(View, { style: { flex: 1 } }, showOverlay && /* @__PURE__ */ React.createElement(Pressable, { onPress: onClose, style: { flex: 1 } }, /* @__PURE__ */ React.createElement(Animated.View, { style: [styles.overlay, { opacity: overlayOpacity }] })), /* @__PURE__ */ React.createElement(
|
|
219
|
-
Animated.View,
|
|
220
|
-
{
|
|
221
|
-
style: [
|
|
222
|
-
styles.drawerContainer,
|
|
223
|
-
positionStyle,
|
|
224
|
-
containerStyle,
|
|
225
|
-
{
|
|
226
|
-
transform: [{ translateX }, { translateY }]
|
|
227
|
-
},
|
|
228
|
-
customStyle
|
|
229
|
-
]
|
|
230
|
-
},
|
|
231
|
-
children
|
|
232
|
-
))
|
|
233
|
-
);
|
|
234
|
-
};
|
|
235
|
-
export {
|
|
236
|
-
Drawer
|
|
237
|
-
};
|