cdslibrary 1.2.80 → 1.2.82

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,19 +1,29 @@
1
- import React, { useState, useRef } from "react";
2
- import { View, Text, StyleSheet, TouchableOpacity, Platform, Animated } from "react-native";
1
+ import React, { useState, useRef, useEffect } from "react";
2
+ import { View, Text, StyleSheet, TouchableOpacity, Animated } from "react-native";
3
3
  import { MaterialIcons } from "@expo/vector-icons";
4
4
  import { useTheme } from "../context/CDSThemeContext";
5
5
 
6
6
  export const CDSCardFeedback = ({
7
7
  style,
8
8
  title,
9
- description,
9
+ message,
10
10
  secondAction,
11
11
  onPressSecondAction,
12
- onClose
12
+ onClose,
13
+ onCloseLabel = 'Cerrar'
13
14
  }) => {
14
15
  const { theme } = useTheme();
15
16
  const [isVisible, setIsVisible] = useState(true);
16
- const fadeAnim = useRef(new Animated.Value(1)).current;
17
+
18
+ const fadeAnim = useRef(new Animated.Value(0)).current;
19
+
20
+ useEffect(() => {
21
+ Animated.timing(fadeAnim, {
22
+ toValue: 1,
23
+ duration: 400, // Un poco más lento que la salida se siente mejor
24
+ useNativeDriver: false,
25
+ }).start();
26
+ }, []);
17
27
 
18
28
  const handleClose = () => {
19
29
  // IMPORTANTE: useNativeDriver debe ser false para animar maxHeight y padding
@@ -39,14 +49,12 @@ export const CDSCardFeedback = ({
39
49
 
40
50
  const currentStyle = feedbackStyles[style] || feedbackStyles.info;
41
51
 
42
- // Interpolamos todos los valores físicos para que colapsen a 0
43
- const animatedLayout = {
52
+ const animatedLayout = {
53
+ opacity: fadeAnim,
44
54
  maxHeight: fadeAnim.interpolate({
45
55
  inputRange: [0, 1],
46
- outputRange: [0, 600] // Suficiente para el contenido
56
+ outputRange: [0, 600]
47
57
  }),
48
- opacity: fadeAnim,
49
- // Animamos el padding y el margen para que no queden espacios vacíos al cerrar
50
58
  paddingVertical: fadeAnim.interpolate({
51
59
  inputRange: [0, 1],
52
60
  outputRange: [0, theme.space.md]
@@ -55,8 +63,13 @@ export const CDSCardFeedback = ({
55
63
  inputRange: [0, 1],
56
64
  outputRange: [0, theme.space.sm]
57
65
  }),
58
- borderWidth: 1,
59
-
66
+ // También animamos la escala para un efecto más premium
67
+ transform: [{
68
+ scale: fadeAnim.interpolate({
69
+ inputRange: [0, 1],
70
+ outputRange: [0.95, 1]
71
+ })
72
+ }]
60
73
  };
61
74
 
62
75
  return (
@@ -85,9 +98,9 @@ export const CDSCardFeedback = ({
85
98
  </View>
86
99
  )}
87
100
 
88
- {description && (
89
- <Text style={[styles.description, theme.typography.regular.md, { color: currentStyle.text }]}>
90
- {description}
101
+ {message && (
102
+ <Text style={[styles.message, theme.typography.regular.md, { color: currentStyle.text }]}>
103
+ {message}
91
104
  </Text>
92
105
  )}
93
106
 
@@ -101,7 +114,7 @@ export const CDSCardFeedback = ({
101
114
  )}
102
115
  <TouchableOpacity onPress={handleClose}>
103
116
  <Text style={[theme.typography.bold.sm, { color: currentStyle.text }]}>
104
- {'Cerrar'}
117
+ {onCloseLabel}
105
118
  </Text>
106
119
  </TouchableOpacity>
107
120
  </View>
@@ -118,7 +131,7 @@ const styles = StyleSheet.create({
118
131
  flexDirection: 'row',
119
132
  alignItems: 'center',
120
133
  },
121
- description: {},
134
+ message: {},
122
135
  actionsContainer: {
123
136
  flexDirection: 'row',
124
137
  width: '100%',
@@ -6,7 +6,7 @@ export const CDSSwitch = ({ label, onValueChange, value }) => {
6
6
  const { theme } = useTheme();
7
7
 
8
8
  return (
9
- <View style={[styles.container, { marginVertical: theme.space.sm }]}>
9
+ <View style={[styles.container, { }]}>
10
10
  {label && (
11
11
  <Text style={[
12
12
  theme.typography.label,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cdslibrary",
3
3
  "license": "0BSD",
4
- "version": "1.2.80",
4
+ "version": "1.2.82",
5
5
  "main": "index.js",
6
6
  "author": "Nat Viramontes",
7
7
  "description": "A library of components for the CDS project",