cdslibrary 1.2.8 → 1.2.10

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.
@@ -26,16 +26,18 @@ export const CDSBottomSheet = ({
26
26
  }) => {
27
27
 
28
28
  const handleLayout = (event) => {
29
- const { width } = event.nativeEvent.layout;
30
- setChildHeight(width); // Guardamos el ancho en el estado
29
+ const { height: layoutHeight } = event.nativeEvent.layout;
30
+ setChildHeight(layoutHeight);
31
31
  };
32
32
 
33
33
  const { theme } = useTheme();
34
-
34
+ const [childHeight, setChildHeight] = useState(0);
35
35
  const [modalVisible, setModalVisible] = useState(isVisible);
36
36
  const [modalOpacity] = useState(new Animated.Value(0));
37
37
  const [slidePosition] = useState(new Animated.Value(height));
38
38
 
39
+
40
+
39
41
  useEffect(() => {
40
42
  const targetValue = isMobile ? height : width; // Valor fuera de pantalla
41
43
 
@@ -71,7 +73,6 @@ export const CDSBottomSheet = ({
71
73
  }, isMobile ? [styles.container.typeBottomSheet, {
72
74
  borderTopLeftRadius: theme.radius.lg,
73
75
  borderTopRightRadius: theme.radius.lg,
74
-
75
76
  }] : [styles.container.typeDrawer, {
76
77
  borderBottomLeftRadius: theme.radius.lg, borderTopLeftRadius: theme.radius.lg, paddingBottom: theme.space.md,
77
78
  },
@@ -83,12 +84,15 @@ export const CDSBottomSheet = ({
83
84
  name={"close"}
84
85
  size={theme.typography.icon.lg}
85
86
  color={theme.text.neutral.primary}
86
- onPress={() => setModalVisible(false)}
87
+ onPress={() => {
88
+ onFinish();
89
+ setModalVisible(false);
90
+ }}
87
91
  style={{ position: "absolute", right: theme.space.sm, top: theme.space.sm }}
88
92
  />
89
93
  )}
90
- {title && <Text style={theme.typography.bold.lg}>{title}</Text>}
91
- <View style={styles.scrollWrapper}> {/* 👈 Nuevo View para envolver */}
94
+ <Text style={theme.typography.bold.lg}>{title}</Text>
95
+ <View style={styles.scrollWrapper}>
92
96
  <ScrollView
93
97
  style={styles.scrollArea}
94
98
  contentContainerStyle={[styles.scrollContent, {
@@ -104,28 +108,29 @@ export const CDSBottomSheet = ({
104
108
  )}
105
109
  {customSlot && <View style={styles.customSlot}>{customSlot}</View>}
106
110
  </ScrollView>
107
-
108
- {/* El Gradiente */}
109
111
  <LinearGradient
110
- colors={['transparent', theme.surface.neutral.primary]} // Ajusta los colores
112
+ colors={['transparent', theme.surface.neutral.primary]}
111
113
  style={styles.fadeGradient}
112
- pointerEvents="none" // Importante para que no bloquee el click en los botones debajo
114
+ pointerEvents="none"
113
115
  />
114
116
  </View>
115
117
  {type !== "informative" && (
116
118
  <View style={isMobile ? styles.actionsContainer.typeBottomSheet : styles.actionsContainer.typeDrawer}>
117
119
  <CDSButton
118
120
  label={primaryButtonLabel}
119
- onPress={
120
- onFinish
121
- ? () => setModalVisible(!modalVisible)
122
- : primaryButtonOnPress
121
+ onPress={() => {
122
+ primaryButtonOnPress(),
123
+ setModalVisible(!modalVisible)
124
+ }
123
125
  }
124
126
  />
125
127
  <CDSButton
126
128
  label={secondaryButtonLabel}
127
129
  type="ghost"
128
- onPress={() => setModalVisible(!modalVisible)}
130
+ onPress={() => {
131
+ onFinish();
132
+ setModalVisible(false);
133
+ }}
129
134
  />
130
135
  </View>
131
136
  )}
@@ -182,10 +187,10 @@ const styles = StyleSheet.create({
182
187
  width: '100%',
183
188
  },
184
189
  scrollArea: {
185
- flexShrink: 1,
190
+ flexShrink: 1,
186
191
  flexGrow: 1,
187
- width: '100%',
188
- paddingBottom: 20,
192
+ width: '100%',
193
+ paddingBottom: 20,
189
194
  },
190
195
 
191
196
  scrollContent: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cdslibrary",
3
3
  "license": "0BSD",
4
- "version": "1.2.8",
4
+ "version": "1.2.10",
5
5
  "main": "index.js",
6
6
  "author": "Nat Viramontes",
7
7
  "description": "A library of components for the CDS project",