cdslibrary 1.0.43 → 1.0.45

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,12 +1,12 @@
1
- import React, { useEffect, useState } from "react";
1
+ import React from "react";
2
2
  import { Text, StyleSheet, TouchableOpacity } from "react-native";
3
3
  import { Dimensions, Platform } from "react-native";
4
4
  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
8
+ const { width } = Dimensions.get("window");
9
+ const isMobile = width <= 768
10
10
 
11
11
  export const CDSButton = ({
12
12
  label,
@@ -33,46 +33,30 @@ export const CDSButton = ({
33
33
  ? theme.text.neutral.disabled
34
34
  : theme.text.neutral.contrast;
35
35
 
36
- const { width } = Dimensions.get("window");
37
-
38
- // Estado para manejar el ancho del dispositivo
39
- const [isMobile, setIsMobile] = useState(width <= 768);
40
-
41
- // Efecto para detectar cambios en el tamaño de la ventana en la web
42
- useEffect(() => {
43
- const handleResize = () => {
44
- const { width } = Dimensions.get("window");
45
- setIsMobile(width <= 768);
46
- };
47
-
48
- const subscription = Dimensions.addEventListener("change", handleResize);
49
- return () => subscription?.remove(); // Limpia el listener
50
- }, []);
51
- console.log(isMobile)
52
- return (
53
- <TouchableOpacity
54
- onPress={type !== "disabled" ? onPress : null}
55
- activeOpacity={0.7}
56
- style={[
57
- styles.container,
58
- { backgroundColor },
59
- flexend && { justifyContent: "flex-end", paddingHorizontal: 0 },
60
- {
61
- paddingHorizontal: type === "icon" ? 12 : 24,
62
- ...(isMobile && { width: "100%" })
63
- },
64
- type === "secondary" && {
65
- borderColor: theme.outline.action.primary,
66
- borderWidth: 1,
67
- },
68
- type === 'link' && {
69
- paddingHorizontal: 0,
70
- paddingVertical: 0,
71
- width: 'auto',
72
- minWidth: 1,
73
- }
74
- ]}
75
- >
36
+ return (
37
+ <TouchableOpacity
38
+ onPress={type !== "disabled" ? onPress : null}
39
+ activeOpacity={0.7}
40
+ style={[
41
+ styles.container,
42
+ { backgroundColor },
43
+ flexend && { justifyContent: "flex-end", paddingHorizontal: 0 },
44
+ {
45
+ paddingHorizontal: type === "icon" ? 12 : 24,
46
+ ...(isMobile && { width: "100%" })
47
+ },
48
+ type === "secondary" && {
49
+ borderColor: theme.outline.action.primary,
50
+ borderWidth: 1,
51
+ },
52
+ type === 'link' && {
53
+ paddingHorizontal: 0,
54
+ paddingVertical: 0,
55
+ width: 'auto',
56
+ minWidth: 1,
57
+ }
58
+ ]}
59
+ >
76
60
  {type !== "icon" && (
77
61
  <Text
78
62
  style={[
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cdslibrary",
3
3
  "license": "0BSD",
4
- "version": "1.0.43",
4
+ "version": "1.0.45",
5
5
  "main": "index.js",
6
6
  "author": "Nat Viramontes",
7
7
  "description": "A library of components for the CDS project",