cdslibrary 1.2.76 → 1.2.78
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/components/CDSLoader.jsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
2
|
import { View, StyleSheet, Modal, Text } from "react-native";
|
|
3
3
|
import LottieView from "lottie-react-native";
|
|
4
|
-
import Animated, {
|
|
5
|
-
useSharedValue,
|
|
6
|
-
useAnimatedStyle,
|
|
7
|
-
withTiming,
|
|
4
|
+
import Animated, {
|
|
5
|
+
useSharedValue,
|
|
6
|
+
useAnimatedStyle,
|
|
7
|
+
withTiming,
|
|
8
8
|
withDelay, // 👈 Importamos withDelay
|
|
9
|
-
runOnJS
|
|
9
|
+
runOnJS
|
|
10
10
|
} from "react-native-reanimated";
|
|
11
11
|
import { useTheme } from "../context/CDSThemeContext";
|
|
12
12
|
|
|
@@ -19,12 +19,12 @@ export const CDSLoader = ({ visible = false, message }) => {
|
|
|
19
19
|
if (visible) {
|
|
20
20
|
setShouldRender(true);
|
|
21
21
|
// Entrada rápida para que no se sienta lag al empezar
|
|
22
|
-
opacity.value = withTiming(1, { duration: 300 });
|
|
22
|
+
opacity.value = withTiming(1, { duration: 300 });
|
|
23
23
|
} else {
|
|
24
24
|
// 1. Espera 800ms antes de hacer nada (Sostenido)
|
|
25
25
|
// 2. Desvanece lentamente en 1200ms
|
|
26
26
|
opacity.value = withDelay(
|
|
27
|
-
1000,
|
|
27
|
+
1000,
|
|
28
28
|
withTiming(0, { duration: 1200 }, (isFinished) => {
|
|
29
29
|
if (isFinished) {
|
|
30
30
|
runOnJS(setShouldRender)(false);
|
|
@@ -37,12 +37,12 @@ export const CDSLoader = ({ visible = false, message }) => {
|
|
|
37
37
|
const animatedStyle = useAnimatedStyle(() => ({
|
|
38
38
|
opacity: opacity.value,
|
|
39
39
|
}));
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
if (!shouldRender && !visible) return null;
|
|
42
42
|
return (
|
|
43
43
|
<Modal transparent visible={shouldRender} animationType="none">
|
|
44
|
-
<Animated.View style={[styles.overlay, animatedStyle,
|
|
45
|
-
|
|
44
|
+
<Animated.View style={[styles.overlay, animatedStyle,
|
|
45
|
+
{ backgroundColor: theme.surface.special.overlay },]}>
|
|
46
46
|
<View
|
|
47
47
|
style={[
|
|
48
48
|
styles.loaderContainer,
|
|
@@ -54,7 +54,8 @@ console.log(theme)
|
|
|
54
54
|
source={require("../assets/animations/animationLoaderWhite.json")}
|
|
55
55
|
resizeMode="contain"
|
|
56
56
|
/>
|
|
57
|
-
{message && <Text
|
|
57
|
+
{message && <Text
|
|
58
|
+
style={[theme.typography.semiBold.md, { textAlign: 'center', width:'100%', color: theme.text.special.loader }]}>
|
|
58
59
|
{message}
|
|
59
60
|
</Text>}
|
|
60
61
|
</View>
|
|
@@ -66,17 +67,17 @@ console.log(theme)
|
|
|
66
67
|
const styles = StyleSheet.create({
|
|
67
68
|
overlay: {
|
|
68
69
|
height: '100%',
|
|
69
|
-
width: '100%',
|
|
70
|
+
width: '100%',
|
|
70
71
|
justifyContent: "center",
|
|
71
72
|
alignItems: "center",
|
|
72
73
|
zIndex: 1000,
|
|
73
74
|
},
|
|
74
75
|
loaderContainer: {
|
|
75
|
-
padding: 20,
|
|
76
|
+
padding: 20,
|
|
76
77
|
// O si usas fijos, asegúrate que sean mayores al estilo del Lottie
|
|
77
|
-
minWidth: 180,
|
|
78
|
+
minWidth: 180,
|
|
78
79
|
minHeight: 180,
|
|
79
|
-
maxWidth:
|
|
80
|
+
maxWidth: 400,
|
|
80
81
|
justifyContent: "center",
|
|
81
82
|
alignItems: "center",
|
|
82
83
|
},
|