ikualo-ui-kit-mobile 2.1.3 → 2.1.5
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
package/package.json
CHANGED
|
@@ -31,16 +31,13 @@ class PriorityManager {
|
|
|
31
31
|
// Si hay un diálogo actual y el nuevo tiene mayor prioridad, cerrar el actual
|
|
32
32
|
if (this.currentDialog && priority > this.currentDialog.priority) {
|
|
33
33
|
this.currentDialog.onDismiss();
|
|
34
|
-
this.currentDialog = null;
|
|
34
|
+
this.currentDialog = null;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// Si no hay diálogo actual o el nuevo tiene mayor prioridad, mostrarlo
|
|
38
38
|
if (!this.currentDialog || priority > this.currentDialog.priority) {
|
|
39
39
|
this.currentDialog = { id, priority, onDismiss };
|
|
40
40
|
this.notify();
|
|
41
|
-
} else {
|
|
42
|
-
// Si el diálogo no puede mostrarse por prioridad menor, eliminarlo completamente
|
|
43
|
-
// No mantener referencia alguna al diálogo rechazado
|
|
44
41
|
}
|
|
45
42
|
}
|
|
46
43
|
|
|
@@ -62,13 +59,16 @@ class PriorityManager {
|
|
|
62
59
|
}
|
|
63
60
|
}
|
|
64
61
|
|
|
65
|
-
export const DialogDown = (props: IDialogDown & { priority?: 0 | 1 | 2 | 3 | 4 | 5 }) => {
|
|
62
|
+
export const DialogDown = (props: IDialogDown & { priority?: 0 | 1 | 2 | 3 | 4 | 5; id?: string }) => {
|
|
66
63
|
const theme = useStore().theme;
|
|
67
64
|
const stylesDialog = getStylesDialog(theme);
|
|
68
|
-
const { isVisible, title, children, onDismiss, image, showCloseButton = true, priority = 0 } = props;
|
|
65
|
+
const { isVisible, title, children, onDismiss, image, showCloseButton = true, priority = 0, id } = props;
|
|
69
66
|
const slideAnim = useRef(new Animated.Value(0)).current;
|
|
70
67
|
const [currentDialog, setCurrentDialog] = useState<{ id: string; priority: number } | null>(null);
|
|
71
|
-
const [dialogId] = useState(() =>
|
|
68
|
+
const [dialogId] = useState(() => {
|
|
69
|
+
// Si se proporciona un id, usarlo. Si no, generar uno aleatorio
|
|
70
|
+
return id || Math.random().toString(36).substring(2, 11);
|
|
71
|
+
});
|
|
72
72
|
const priorityManager = useRef(PriorityManager.getInstance());
|
|
73
73
|
|
|
74
74
|
const handleDismissKeyboard = () => {
|
|
@@ -85,7 +85,7 @@ export const DialogDown = (props: IDialogDown & { priority?: 0 | 1 | 2 | 3 | 4 |
|
|
|
85
85
|
return () => {
|
|
86
86
|
unsubscribe();
|
|
87
87
|
};
|
|
88
|
-
}, []);
|
|
88
|
+
}, [dialogId]);
|
|
89
89
|
|
|
90
90
|
// Manejar cuando se debe mostrar/ocultar el diálogo
|
|
91
91
|
useEffect(() => {
|
|
@@ -5,10 +5,12 @@ import { View } from 'react-native';
|
|
|
5
5
|
import useStore from '../../store';
|
|
6
6
|
import { IInputEmail } from '../../models';
|
|
7
7
|
import MaterialIcons from '@expo/vector-icons/MaterialIcons';
|
|
8
|
+
|
|
8
9
|
export const InputEmail = (props: IInputEmail) => {
|
|
9
10
|
const theme = useStore().theme;
|
|
10
11
|
const styleInput = getStyleInput(theme);
|
|
11
12
|
const [isFocus, setIsFocus] = useState<boolean>(false);
|
|
13
|
+
|
|
12
14
|
const {
|
|
13
15
|
label,
|
|
14
16
|
isDisabled,
|
|
@@ -29,10 +31,12 @@ export const InputEmail = (props: IInputEmail) => {
|
|
|
29
31
|
pattern,
|
|
30
32
|
placeholder,
|
|
31
33
|
} = props;
|
|
34
|
+
|
|
32
35
|
const patternEmailDefault = pattern ?? /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
36
|
+
|
|
33
37
|
const handleInputChange = (text: string) => {
|
|
34
|
-
onChange(text
|
|
35
|
-
if (patternEmailDefault && !patternEmailDefault.test(text)) {
|
|
38
|
+
onChange(text);
|
|
39
|
+
if (patternEmailDefault && !patternEmailDefault.test(text.trim().toLowerCase())) {
|
|
36
40
|
onInvalid && onInvalid();
|
|
37
41
|
}
|
|
38
42
|
};
|
|
@@ -40,7 +44,7 @@ export const InputEmail = (props: IInputEmail) => {
|
|
|
40
44
|
return (
|
|
41
45
|
<View>
|
|
42
46
|
<TextInput
|
|
43
|
-
label={!isFocus && placeholder && value
|
|
47
|
+
label={!isFocus && placeholder && (!value || value.trim() === '') ? placeholder : label}
|
|
44
48
|
mode={mode ?? 'flat'}
|
|
45
49
|
disabled={isDisabled}
|
|
46
50
|
value={value}
|
|
@@ -66,7 +70,7 @@ export const InputEmail = (props: IInputEmail) => {
|
|
|
66
70
|
style={[styleInput['input-label'], style ?? []]}
|
|
67
71
|
contentStyle={[
|
|
68
72
|
styleInput['input-label'],
|
|
69
|
-
!isValid && !isFocus && value.trim() !== '' && styleInput['input-txt-error'],
|
|
73
|
+
!isValid && !isFocus && value && value.trim() !== '' && styleInput['input-txt-error'],
|
|
70
74
|
style ?? [styleInput['input-txt']],
|
|
71
75
|
]}
|
|
72
76
|
underlineColor={
|
|
@@ -79,11 +83,18 @@ export const InputEmail = (props: IInputEmail) => {
|
|
|
79
83
|
activeUnderlineColor={
|
|
80
84
|
activeUnderlineColor
|
|
81
85
|
? activeUnderlineColor
|
|
82
|
-
: !isValid && value.trim() !== ''
|
|
86
|
+
: !isValid && value && value.trim() !== ''
|
|
83
87
|
? styleInput['input-text--activeUnderline'].color
|
|
84
88
|
: ''
|
|
85
89
|
}
|
|
86
90
|
underlineStyle={{ height: isFocus ? 1.5 : 2 }}
|
|
91
|
+
autoCapitalize="none"
|
|
92
|
+
autoCorrect={false}
|
|
93
|
+
keyboardType="email-address"
|
|
94
|
+
autoComplete="email"
|
|
95
|
+
textContentType="emailAddress"
|
|
96
|
+
importantForAutofill="yes"
|
|
97
|
+
spellCheck={false}
|
|
87
98
|
/>
|
|
88
99
|
{isValid && (
|
|
89
100
|
<HelperText type="info" style={styleInput['input-password-helper']} visible={true}>
|