ikualo-ui-kit-mobile 2.0.10 → 2.0.12

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.
package/app.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "ikualo-app-2.0",
4
4
  "slug": "ikualo-app-20",
5
5
  "owner": "ikualo",
6
- "version": "2.0.10",
6
+ "version": "2.0.12",
7
7
  "orientation": "portrait",
8
8
  "icon": "./assets/icon.png",
9
9
  "userInterfaceStyle": "automatic",
@@ -121,12 +121,12 @@ const getStylesBtnLightSmall = (theme: ITheme) =>
121
121
  'btn-light-small': {
122
122
  borderWidth: 1,
123
123
  borderRadius: 36,
124
- maxWidth: 48,
125
- minWidth: 48,
126
- maxHeight: 48,
127
- minHeight: 48,
128
- width: 48,
129
- height: 48,
124
+ maxWidth: 50,
125
+ minWidth: 50,
126
+ maxHeight: 50,
127
+ minHeight: 50,
128
+ width: 50,
129
+ height: 50,
130
130
  position: 'relative',
131
131
  },
132
132
  'btn-light-small--primary': {
@@ -142,12 +142,12 @@ const getStylesBtnLightSmall = (theme: ITheme) =>
142
142
  'btn-light-small-content': {
143
143
  alignSelf: 'center',
144
144
  alignItems: 'center',
145
- maxWidth: 48,
146
- minWidth: 48,
147
- maxHeight: 48,
148
- minHeight: 48,
149
- width: 48,
150
- height: 48,
145
+ maxWidth: 50,
146
+ minWidth: 50,
147
+ maxHeight: 50,
148
+ minHeight: 50,
149
+ width: 50,
150
+ height: 50,
151
151
  },
152
152
  'btn-light-small-label': {
153
153
  fontSize: 24,
@@ -157,24 +157,24 @@ const getStylesBtnLightSmall = (theme: ITheme) =>
157
157
  borderColor: theme.colors.icon_disabled,
158
158
  borderRadius: 8,
159
159
  borderWidth: 1,
160
- maxWidth: 48,
161
- minWidth: 48,
162
- maxHeight: 48,
163
- minHeight: 48,
164
- width: 48,
165
- height: 48,
160
+ maxWidth: 50,
161
+ minWidth: 50,
162
+ maxHeight: 50,
163
+ minHeight: 50,
164
+ width: 50,
165
+ height: 50,
166
166
  },
167
167
  'btn-light-small--active': {
168
168
  backgroundColor: theme.colors.background_freezed,
169
169
  borderColor: theme.colors.freezed,
170
170
  borderRadius: 100,
171
171
  borderWidth: 1,
172
- maxWidth: 48,
173
- minWidth: 48,
174
- maxHeight: 48,
175
- minHeight: 48,
176
- width: 48,
177
- height: 48,
172
+ maxWidth: 50,
173
+ minWidth: 50,
174
+ maxHeight: 50,
175
+ minHeight: 50,
176
+ width: 50,
177
+ height: 50,
178
178
  },
179
179
  'btn-light-small-label--disabled': {
180
180
  color: theme.colors.icon_disabled,
@@ -227,8 +227,8 @@ const getStylesButtonActionCircle = (theme: ITheme) =>
227
227
  StyleSheet.create({
228
228
  'btn-container-item': {
229
229
  display: 'flex',
230
- width: 48,
231
- height: 48,
230
+ width: 50,
231
+ height: 50,
232
232
  justifyContent: 'center',
233
233
  borderRadius: 50,
234
234
  alignItems: 'center',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ikualo-ui-kit-mobile",
3
- "version": "2.0.10",
3
+ "version": "2.0.12",
4
4
  "main": "src/index.ts",
5
5
  "scripts": {
6
6
  "start": "expo start",
@@ -51,17 +51,17 @@ class DialogManager {
51
51
  // Agregar a la cola
52
52
  this.dialogs.push(dialog);
53
53
 
54
- // Si no hay diálogo actual, mostrar el nuevo
55
- if (!this.currentDialog) {
56
- this.showNextDialog();
57
- }
54
+ // Siempre mostrar el siguiente diálogo (por prioridad)
55
+ this.showNextDialog();
58
56
 
59
57
  this.notify();
60
58
  }
61
59
 
62
60
  removeDialog(id: string) {
61
+ // Remover de la cola
63
62
  this.dialogs = this.dialogs.filter((dialog) => dialog.id !== id);
64
63
 
64
+ // Si el diálogo que se está removiendo es el actual, limpiar y mostrar el siguiente
65
65
  if (this.currentDialog?.id === id) {
66
66
  this.currentDialog = null;
67
67
  this.showNextDialog();
@@ -82,6 +82,8 @@ class DialogManager {
82
82
  // Ordenar por prioridad (mayor prioridad primero)
83
83
  this.dialogs.sort((a, b) => b.priority - a.priority);
84
84
  this.currentDialog = this.dialogs[0];
85
+ } else {
86
+ this.currentDialog = null;
85
87
  }
86
88
  }
87
89
 
@@ -90,10 +92,25 @@ class DialogManager {
90
92
  }
91
93
 
92
94
  clear() {
95
+ console.log('DialogManager: Clearing all dialogs');
93
96
  this.dialogs = [];
94
97
  this.currentDialog = null;
95
98
  this.notify();
96
99
  }
100
+
101
+ // Método para forzar la limpieza de un diálogo específico
102
+ forceRemoveDialog(id: string) {
103
+ console.log('DialogManager: Force removing dialog', { id });
104
+ this.dialogs = this.dialogs.filter((dialog) => dialog.id !== id);
105
+
106
+ if (this.currentDialog?.id === id) {
107
+ this.currentDialog = null;
108
+ }
109
+
110
+ // Mostrar el siguiente diálogo si hay alguno
111
+ this.showNextDialog();
112
+ this.notify();
113
+ }
97
114
  }
98
115
 
99
116
  export const DialogDown = (props: IDialogDown & { priority?: 0 | 1 | 2 | 3 | 4 | 5 }) => {
@@ -113,41 +130,62 @@ export const DialogDown = (props: IDialogDown & { priority?: 0 | 1 | 2 | 3 | 4 |
113
130
  // Suscribirse a cambios en el diálogo actual
114
131
  useEffect(() => {
115
132
  const unsubscribe = dialogManager.current.subscribe(() => {
116
- setCurrentDialog(dialogManager.current.getCurrentDialog());
133
+ const newCurrentDialog = dialogManager.current.getCurrentDialog();
134
+ setCurrentDialog(newCurrentDialog);
117
135
  });
118
136
  return () => {
119
137
  unsubscribe();
120
138
  };
121
139
  }, []);
122
140
 
141
+ // Función helper para agregar diálogo al manager
142
+ const addDialogToManager = (dialogId: string) => {
143
+ dialogManager.current.addDialog({
144
+ ...props,
145
+ id: dialogId,
146
+ priority: priority || 0,
147
+ onDismiss: () => {
148
+ Animated.timing(slideAnim, {
149
+ toValue: 0,
150
+ duration: 200,
151
+ useNativeDriver: true,
152
+ }).start(() => {
153
+ dialogManager.current.removeDialog(dialogId);
154
+ setDialogId(null);
155
+ onDismiss();
156
+ });
157
+ },
158
+ });
159
+ };
160
+
123
161
  // Manejar cuando se debe mostrar/ocultar el diálogo
124
162
  useEffect(() => {
125
163
  if (isVisible) {
126
- const newDialogId = Math.random().toString(36).substr(2, 9);
127
- setDialogId(newDialogId);
128
-
129
- dialogManager.current.addDialog({
130
- ...props,
131
- id: newDialogId,
132
- priority: priority || 0, // Si no se especifica prioridad, usar 0 (sin prioridad)
133
- onDismiss: () => {
134
- Animated.timing(slideAnim, {
135
- toValue: 0,
136
- duration: 200,
137
- useNativeDriver: true,
138
- }).start(() => {
139
- dialogManager.current.removeDialog(newDialogId);
140
- onDismiss();
141
- });
142
- },
143
- });
144
- } else {
164
+ if (!dialogId) {
165
+ // Generar nuevo ID cada vez que se muestra el diálogo
166
+ const newDialogId = Math.random().toString(36).substring(2, 11);
167
+ setDialogId(newDialogId);
168
+ } else if (dialogId && !currentDialog) {
169
+ // Si ya tiene ID pero no está en el manager, agregarlo
170
+ addDialogToManager(dialogId);
171
+ } else if (dialogId && currentDialog && currentDialog.id !== dialogId) {
172
+ // Si ya tiene ID pero hay otro diálogo actual, agregarlo (el manager manejará prioridades)
173
+ addDialogToManager(dialogId);
174
+ }
175
+ } else if (dialogId) {
176
+ dialogManager.current.removeDialog(dialogId);
177
+ setDialogId(null);
178
+ }
179
+ }, [isVisible, dialogId, currentDialog, priority, title]);
180
+
181
+ // Cleanup al desmontar el componente
182
+ useEffect(() => {
183
+ return () => {
145
184
  if (dialogId) {
146
185
  dialogManager.current.removeDialog(dialogId);
147
- setDialogId(null);
148
186
  }
149
- }
150
- }, [isVisible, priority]);
187
+ };
188
+ }, [dialogId]);
151
189
 
152
190
  // Animación basada en si este diálogo es el actual
153
191
  useEffect(() => {
@@ -178,11 +216,15 @@ export const DialogDown = (props: IDialogDown & { priority?: 0 | 1 | 2 | 3 | 4 |
178
216
  const handleDismiss = () => {
179
217
  if (dialogId) {
180
218
  dialogManager.current.removeDialog(dialogId);
219
+ // Limpiar el dialogId inmediatamente después de remover
220
+ setDialogId(null);
181
221
  }
222
+ // Llamar onDismiss para que el componente padre cambie isVisible a false
223
+ onDismiss();
182
224
  };
183
225
 
184
226
  // Solo renderizar si este diálogo es el actual
185
- const isCurrentDialog = Boolean(currentDialog && currentDialog.id === dialogId);
227
+ const isCurrentDialog = Boolean(isVisible && dialogId && currentDialog && currentDialog.id === dialogId);
186
228
 
187
229
  return (
188
230
  <Modal visible={isCurrentDialog} transparent={true} animationType="none" onRequestClose={handleDismiss}>