cdslibrary 1.2.55 → 1.2.57
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/CDSSnackBar.jsx +17 -13
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
import { StyleSheet, Text, TouchableOpacity,
|
|
2
|
+
import { StyleSheet, Text, TouchableOpacity, } from "react-native";
|
|
3
3
|
import Animated, {
|
|
4
4
|
useSharedValue,
|
|
5
5
|
useAnimatedStyle,
|
|
@@ -18,7 +18,11 @@ export const CDSSnackBar = ({ message, visible, onDismiss, action }) => {
|
|
|
18
18
|
// Sincronizar visibilidad con animación
|
|
19
19
|
useEffect(() => {
|
|
20
20
|
if (visible) {
|
|
21
|
-
translateY.value = withSpring(0, {
|
|
21
|
+
translateY.value = withSpring(0, {
|
|
22
|
+
damping: 25,
|
|
23
|
+
stiffness: 90,
|
|
24
|
+
overshootClamping: true
|
|
25
|
+
});
|
|
22
26
|
} else {
|
|
23
27
|
translateY.value = withTiming(150);
|
|
24
28
|
}
|
|
@@ -56,16 +60,16 @@ export const CDSSnackBar = ({ message, visible, onDismiss, action }) => {
|
|
|
56
60
|
});
|
|
57
61
|
|
|
58
62
|
const animatedStyle = useAnimatedStyle(() => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
return {
|
|
64
|
+
transform: [
|
|
65
|
+
{ translateY: translateY.value }
|
|
66
|
+
],
|
|
67
|
+
};
|
|
68
|
+
});
|
|
65
69
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
translateY.value = withTiming(visible ? 0 : 150, { duration: 400 });
|
|
72
|
+
}, [visible]);
|
|
69
73
|
|
|
70
74
|
if (!visible && translateY.value >= 100) return null;
|
|
71
75
|
|
|
@@ -113,8 +117,8 @@ const styles = StyleSheet.create({
|
|
|
113
117
|
flexDirection: 'row',
|
|
114
118
|
alignItems: 'center',
|
|
115
119
|
justifyContent: 'space-between',
|
|
116
|
-
bottom: 40,
|
|
117
|
-
zIndex: 9999,
|
|
120
|
+
bottom: 40,
|
|
121
|
+
zIndex: 9999,
|
|
118
122
|
elevation: 10,
|
|
119
123
|
},
|
|
120
124
|
actionButton: {
|