ikualo-ui-kit-mobile 2.1.18 → 2.1.19
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/app.json +1 -1
- package/package.json +1 -1
- package/src/elements/dialogs/DialogDown.tsx +24 -6
package/app.json
CHANGED
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
Animated,
|
|
10
10
|
BackHandler,
|
|
11
11
|
Platform,
|
|
12
|
+
InteractionManager,
|
|
12
13
|
} from 'react-native';
|
|
13
14
|
import { useEffect, useState, useRef } from 'react';
|
|
14
15
|
import useStore from '../../store';
|
|
@@ -74,6 +75,7 @@ export const DialogDown = (props: IDialogDown & { priority?: 0 | 1 | 2 | 3 | 4 |
|
|
|
74
75
|
const { isVisible, title, children, onDismiss, image, showCloseButton = true, priority = 0, id } = props;
|
|
75
76
|
const slideAnim = useRef(new Animated.Value(0)).current;
|
|
76
77
|
const [currentDialog, setCurrentDialog] = useState<{ id: string; priority: number } | null>(null);
|
|
78
|
+
const [isAnimationReady, setIsAnimationReady] = useState(false);
|
|
77
79
|
const [dialogId] = useState(() => {
|
|
78
80
|
// Si se proporciona un id, usarlo. Si no, generar uno aleatorio
|
|
79
81
|
return id || Math.random().toString(36).substring(2, 11);
|
|
@@ -112,17 +114,32 @@ export const DialogDown = (props: IDialogDown & { priority?: 0 | 1 | 2 | 3 | 4 |
|
|
|
112
114
|
};
|
|
113
115
|
}, [dialogId]);
|
|
114
116
|
|
|
115
|
-
// Animación basada en si este diálogo es el actual
|
|
116
117
|
useEffect(() => {
|
|
117
118
|
const isCurrentDialog = currentDialog?.id === dialogId;
|
|
118
119
|
if (isCurrentDialog) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
setIsAnimationReady(false);
|
|
121
|
+
slideAnim.setValue(0);
|
|
122
|
+
const handle = InteractionManager.runAfterInteractions(() => {
|
|
123
|
+
requestAnimationFrame(() => {
|
|
124
|
+
requestAnimationFrame(() => {
|
|
125
|
+
if (currentDialog?.id === dialogId) {
|
|
126
|
+
setIsAnimationReady(true);
|
|
127
|
+
Animated.timing(slideAnim, {
|
|
128
|
+
toValue: 1,
|
|
129
|
+
duration: 300,
|
|
130
|
+
useNativeDriver: true,
|
|
131
|
+
}).start();
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
return () => {
|
|
138
|
+
handle.cancel();
|
|
139
|
+
};
|
|
124
140
|
} else {
|
|
125
141
|
slideAnim.setValue(0);
|
|
142
|
+
setIsAnimationReady(false);
|
|
126
143
|
}
|
|
127
144
|
}, [currentDialog, slideAnim, dialogId]);
|
|
128
145
|
|
|
@@ -185,6 +202,7 @@ export const DialogDown = (props: IDialogDown & { priority?: 0 | 1 | 2 | 3 | 4 |
|
|
|
185
202
|
}),
|
|
186
203
|
},
|
|
187
204
|
],
|
|
205
|
+
opacity: isAnimationReady ? 1 : 0,
|
|
188
206
|
},
|
|
189
207
|
]}
|
|
190
208
|
>
|