@gluestack-ui/core 4.1.0-alpha.0 → 4.1.0-alpha.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayAnimatePresence.d.ts","sourceRoot":"","sources":["../../../../src/modal/creator/OverlayAnimatePresence.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"OverlayAnimatePresence.d.ts","sourceRoot":"","sources":["../../../../src/modal/creator/OverlayAnimatePresence.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAW1C,eAAO,MAAM,sBAAsB,kFAoElC,CAAC"}
|
|
@@ -1,10 +1,38 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
|
+
import { Animated } from 'react-native';
|
|
2
3
|
import { ExitAnimationContext } from '../../overlay/creator';
|
|
4
|
+
const defaultTransitionConfig = {
|
|
5
|
+
type: 'timing',
|
|
6
|
+
useNativeDriver: true,
|
|
7
|
+
duration: 0,
|
|
8
|
+
delay: 0,
|
|
9
|
+
};
|
|
3
10
|
export const OverlayAnimatePresence = forwardRef(({ children, visible = false, AnimatePresence }, ref) => {
|
|
11
|
+
const animateValue = React.useRef(new Animated.Value(0)).current;
|
|
4
12
|
const [animationState, setAnimationState] = React.useState('');
|
|
5
13
|
const prevVisible = React.useRef(visible);
|
|
6
14
|
const { setExited } = React.useContext(ExitAnimationContext);
|
|
7
15
|
React.useEffect(() => {
|
|
16
|
+
var _a;
|
|
17
|
+
if (animationState === 'entering' || animationState === 'exiting') {
|
|
18
|
+
const startAnimation = animationState === 'entering' ? 1 : 0;
|
|
19
|
+
const transition = defaultTransitionConfig;
|
|
20
|
+
if (AnimatePresence) {
|
|
21
|
+
Animated.sequence([
|
|
22
|
+
Animated[(_a = transition.type) !== null && _a !== void 0 ? _a : 'timing'](animateValue, {
|
|
23
|
+
toValue: startAnimation,
|
|
24
|
+
useNativeDriver: true,
|
|
25
|
+
}),
|
|
26
|
+
]).start(() => {
|
|
27
|
+
if (animationState === 'entering') {
|
|
28
|
+
setAnimationState('entered');
|
|
29
|
+
}
|
|
30
|
+
else if (animationState === 'exiting') {
|
|
31
|
+
setAnimationState('exited');
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
8
36
|
if (animationState === 'exited') {
|
|
9
37
|
setExited(true);
|
|
10
38
|
}
|
|
@@ -15,16 +43,14 @@ export const OverlayAnimatePresence = forwardRef(({ children, visible = false, A
|
|
|
15
43
|
React.useEffect(() => {
|
|
16
44
|
if (prevVisible.current !== visible && !visible) {
|
|
17
45
|
setAnimationState('exiting');
|
|
18
|
-
setTimeout(() => setAnimationState('exited'), 200);
|
|
19
46
|
}
|
|
20
47
|
if (visible) {
|
|
21
48
|
setAnimationState('entering');
|
|
22
|
-
setTimeout(() => setAnimationState('entered'), 200);
|
|
23
49
|
}
|
|
24
50
|
prevVisible.current = visible;
|
|
25
51
|
}, [visible]);
|
|
26
52
|
if (!AnimatePresence) {
|
|
27
|
-
return
|
|
53
|
+
return children;
|
|
28
54
|
}
|
|
29
55
|
return (<AnimatePresence ref={ref}>{visible ? children : null}</AnimatePresence>);
|
|
30
56
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OverlayAnimatePresence.jsx","sourceRoot":"","sources":["../../../../src/modal/creator/OverlayAnimatePresence.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,CAAC,MAAM,sBAAsB,GAAG,UAAU,CAC9C,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,KAAK,EAAE,eAAe,EAAO,EAAE,GAAS,EAAE,EAAE;IACjE,MAAM,CAAC,cAAc,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AAC,CAAC,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC,CACzE,CAAC;AACJ,CAAC,CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gluestack-ui/core",
|
|
3
3
|
"description": "Universal UI components for React Native, Expo, and Next.js",
|
|
4
|
-
"version": "4.1.0-alpha.
|
|
4
|
+
"version": "4.1.0-alpha.1",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/gluestack/gluestack-ui.git"
|