cdslibrary 1.2.18 → 1.2.20
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,73 +1,67 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
2
|
import LottieView from "lottie-react-native";
|
|
3
|
-
import {
|
|
3
|
+
import { useEffect } from "react";
|
|
4
4
|
import Animated, {
|
|
5
5
|
useSharedValue,
|
|
6
6
|
useAnimatedStyle,
|
|
7
7
|
withTiming,
|
|
8
|
+
runOnJS,
|
|
8
9
|
} from "react-native-reanimated";
|
|
9
10
|
import { useTheme } from "../context/CDSThemeContext";
|
|
10
11
|
|
|
11
|
-
export const CDSSplashScreen = ({
|
|
12
|
+
export const CDSSplashScreen = ({ onAnimationFinish }) => {
|
|
12
13
|
const { theme } = useTheme();
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
14
|
+
const translateY = useSharedValue(0);
|
|
15
|
+
const size = useSharedValue(200);
|
|
16
|
+
const opacity = useSharedValue(1);
|
|
17
|
+
|
|
17
18
|
useEffect(() => {
|
|
18
|
-
//
|
|
19
|
-
setTimeout(() => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
19
|
+
// 1. Tiempo de espera de la animación principal (4 seg)
|
|
20
|
+
const timer = setTimeout(() => {
|
|
21
|
+
// 2. Animamos hacia arriba, achicamos y desvanecemos TODO
|
|
22
|
+
translateY.value = withTiming(-350, { duration: 1000 });
|
|
23
|
+
size.value = withTiming(120, { duration: 1000 });
|
|
24
|
+
opacity.value = withTiming(0, { duration: 1000 }, (isFinished) => {
|
|
25
|
+
if (isFinished && onAnimationFinish) {
|
|
26
|
+
// 3. Ejecutamos la función de cierre justo al terminar la animación
|
|
27
|
+
runOnJS(onAnimationFinish)();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}, 4000);
|
|
31
|
+
|
|
32
|
+
return () => clearTimeout(timer);
|
|
33
|
+
}, []);
|
|
34
|
+
|
|
35
|
+
const animatedContainerStyle = useAnimatedStyle(() => ({
|
|
36
|
+
opacity: opacity.value,
|
|
37
|
+
backgroundColor: theme.surface.special.progress,
|
|
38
|
+
}));
|
|
29
39
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
height: size.value, // Usar el tamaño animado
|
|
36
|
-
};
|
|
37
|
-
},[]);
|
|
40
|
+
const animatedIconStyle = useAnimatedStyle(() => ({
|
|
41
|
+
transform: [{ translateY: translateY.value }],
|
|
42
|
+
width: size.value,
|
|
43
|
+
height: size.value,
|
|
44
|
+
}));
|
|
38
45
|
|
|
39
46
|
return (
|
|
40
|
-
<View style={styles.background}>
|
|
41
|
-
<View
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
animatedStyle,
|
|
51
|
-
]}
|
|
52
|
-
>
|
|
53
|
-
<LottieView
|
|
54
|
-
autoPlay
|
|
55
|
-
loop={false}
|
|
56
|
-
source={require("../assets/animations/animation.json")}
|
|
57
|
-
style={{ width: "100%", height: "100%" }} // Usar 100% del tamaño del contenedor
|
|
58
|
-
/>
|
|
59
|
-
</Animated.View>
|
|
60
|
-
</View>
|
|
61
|
-
</View>
|
|
47
|
+
<Animated.View style={[styles.background, animatedContainerStyle]}>
|
|
48
|
+
<Animated.View style={animatedIconStyle}>
|
|
49
|
+
<LottieView
|
|
50
|
+
autoPlay
|
|
51
|
+
loop={false}
|
|
52
|
+
source={require("../assets/animations/animation.json")}
|
|
53
|
+
style={{ width: "100%", height: "100%" }}
|
|
54
|
+
/>
|
|
55
|
+
</Animated.View>
|
|
56
|
+
</Animated.View>
|
|
62
57
|
);
|
|
63
|
-
}
|
|
58
|
+
};
|
|
64
59
|
|
|
65
60
|
const styles = StyleSheet.create({
|
|
66
61
|
background: {
|
|
67
62
|
flex: 1,
|
|
68
63
|
justifyContent: "center",
|
|
69
64
|
alignItems: "center",
|
|
70
|
-
backgroundColor: 'blue',
|
|
71
65
|
width: "100%",
|
|
72
66
|
},
|
|
73
67
|
animationContainer: {
|
|
@@ -78,4 +72,4 @@ const styles = StyleSheet.create({
|
|
|
78
72
|
gap: 16,
|
|
79
73
|
padding: 16,
|
|
80
74
|
},
|
|
81
|
-
});
|
|
75
|
+
});
|