cdslibrary 1.2.9 → 1.2.11

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.
@@ -25,22 +25,23 @@ export const CDSBottomSheet = ({
25
25
  onFinish,
26
26
  }) => {
27
27
 
28
- const handleLayout = (event) => {
29
- const { height: layoutHeight } = event.nativeEvent.layout;
30
- setChildHeight(layoutHeight);
31
- };
32
-
28
+
29
+
33
30
  const { theme } = useTheme();
34
31
  const [childHeight, setChildHeight] = useState(0);
35
32
  const [modalVisible, setModalVisible] = useState(isVisible);
36
33
  const [modalOpacity] = useState(new Animated.Value(0));
37
34
  const [slidePosition] = useState(new Animated.Value(height));
38
-
39
-
40
35
 
36
+ const handleLayout = (event) => {
37
+ const { height: layoutHeight } = event.nativeEvent.layout;
38
+ setChildHeight(layoutHeight);
39
+ };
40
+
41
41
  useEffect(() => {
42
42
  const targetValue = isMobile ? height : width; // Valor fuera de pantalla
43
43
 
44
+
44
45
  Animated.parallel([
45
46
  Animated.timing(modalOpacity, {
46
47
  toValue: modalVisible ? 1 : 0,
@@ -84,7 +85,10 @@ const handleLayout = (event) => {
84
85
  name={"close"}
85
86
  size={theme.typography.icon.lg}
86
87
  color={theme.text.neutral.primary}
87
- onPress={() => setModalVisible(false)}
88
+ onPress={() => {
89
+ onFinish && onFinish();
90
+ setModalVisible(false);
91
+ }}
88
92
  style={{ position: "absolute", right: theme.space.sm, top: theme.space.sm }}
89
93
  />
90
94
  )}
@@ -106,25 +110,28 @@ const handleLayout = (event) => {
106
110
  {customSlot && <View style={styles.customSlot}>{customSlot}</View>}
107
111
  </ScrollView>
108
112
  <LinearGradient
109
- colors={['transparent', theme.surface.neutral.primary]}
113
+ colors={['transparent', theme.surface.neutral.primary]}
110
114
  style={styles.fadeGradient}
111
- pointerEvents="none"
115
+ pointerEvents="none"
112
116
  />
113
117
  </View>
114
118
  {type !== "informative" && (
115
119
  <View style={isMobile ? styles.actionsContainer.typeBottomSheet : styles.actionsContainer.typeDrawer}>
116
120
  <CDSButton
117
121
  label={primaryButtonLabel}
118
- onPress={
119
- onFinish
120
- ? () => setModalVisible(!modalVisible)
121
- : primaryButtonOnPress
122
+ onPress={() => {
123
+ primaryButtonOnPress && primaryButtonOnPress();
124
+ setModalVisible(false)
125
+ }
122
126
  }
123
127
  />
124
128
  <CDSButton
125
129
  label={secondaryButtonLabel}
126
130
  type="ghost"
127
- onPress={() => setModalVisible(!modalVisible)}
131
+ onPress={() => {
132
+ onFinish && onFinish();
133
+ setModalVisible(false);
134
+ }}
128
135
  />
129
136
  </View>
130
137
  )}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cdslibrary",
3
3
  "license": "0BSD",
4
- "version": "1.2.9",
4
+ "version": "1.2.11",
5
5
  "main": "index.js",
6
6
  "author": "Nat Viramontes",
7
7
  "description": "A library of components for the CDS project",