cdslibrary 1.0.45 → 1.0.47

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.
@@ -5,9 +5,6 @@ import { MaterialIcons } from "@expo/vector-icons";
5
5
  import { useTheme } from "../context/CDSThemeContext";
6
6
  import { getSemanticTextStyles } from "../tokens/CDSsemanticTextStyles";
7
7
 
8
- const { width } = Dimensions.get("window");
9
- const isMobile = width <= 768
10
-
11
8
  export const CDSButton = ({
12
9
  label,
13
10
  type = "primary",
@@ -33,6 +30,19 @@ export const CDSButton = ({
33
30
  ? theme.text.neutral.disabled
34
31
  : theme.text.neutral.contrast;
35
32
 
33
+ const { width } = Dimensions.get("window");
34
+ const [isMobile, setIsMobile] = useState(width <= 768);
35
+
36
+ useEffect(() => {
37
+ const handleResize = () => {
38
+ const { width } = Dimensions.get("window");
39
+ setIsMobile(width <= 768);
40
+ };
41
+
42
+ const subscription = Dimensions.addEventListener("change", handleResize);
43
+ return () => subscription?.remove(); // Limpia el listener
44
+ }, []);
45
+
36
46
  return (
37
47
  <TouchableOpacity
38
48
  onPress={type !== "disabled" ? onPress : null}
@@ -43,7 +53,7 @@ export const CDSButton = ({
43
53
  flexend && { justifyContent: "flex-end", paddingHorizontal: 0 },
44
54
  {
45
55
  paddingHorizontal: type === "icon" ? 12 : 24,
46
- ...(isMobile && { width: "100%" })
56
+ ...(isMobile && { width: "100%" }) // Se aplica correctamente en Web y Móvil
47
57
  },
48
58
  type === "secondary" && {
49
59
  borderColor: theme.outline.action.primary,
@@ -92,7 +102,6 @@ const styles = StyleSheet.create({
92
102
  paddingHorizontal: 24,
93
103
  borderRadius: 100,
94
104
  gap: 8,
95
- flexShrink: 1,
96
105
  },
97
106
  });
98
107
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cdslibrary",
3
3
  "license": "0BSD",
4
- "version": "1.0.45",
4
+ "version": "1.0.47",
5
5
  "main": "index.js",
6
6
  "author": "Nat Viramontes",
7
7
  "description": "A library of components for the CDS project",