native-pytech 1.0.182 → 1.0.184
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.
|
@@ -75,10 +75,7 @@ const phoneToText = (phone) => {
|
|
|
75
75
|
}
|
|
76
76
|
return extra ? `${base}${extra}` : base;
|
|
77
77
|
};
|
|
78
|
-
const dateToTextFormat = (date, format = 'yyyy-MM-dd') =>
|
|
79
|
-
const _format = format.replaceAll('Y', 'y').replaceAll('m', 'M').replaceAll('D', 'd');
|
|
80
|
-
return DateFormatter(date, format);
|
|
81
|
-
};
|
|
78
|
+
const dateToTextFormat = (date, format = 'yyyy-MM-dd') => DateFormatter(date, format);
|
|
82
79
|
// ------------------- Export -------------------
|
|
83
80
|
const Formats = {
|
|
84
81
|
numberToText,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import Props from './types';
|
|
2
|
-
declare const _default: import("react").MemoExoticComponent<({ children, onSave }: Props) => import("react").JSX.Element>;
|
|
2
|
+
declare const _default: import("react").MemoExoticComponent<({ children, saveEnabled, onSave }: Props) => import("react").JSX.Element>;
|
|
3
3
|
export default _default;
|
|
@@ -4,7 +4,7 @@ import { memo, useCallback, useMemo, useRef } from 'react';
|
|
|
4
4
|
import { Provider } from '../../context/page';
|
|
5
5
|
import Screen from '../Screen';
|
|
6
6
|
import Header from '../Header';
|
|
7
|
-
export default memo(({ children, onSave }) => {
|
|
7
|
+
export default memo(({ children, saveEnabled, onSave }) => {
|
|
8
8
|
const textFieldsRefs = useRef({});
|
|
9
9
|
const indexRef = useRef(0);
|
|
10
10
|
// Store
|
|
@@ -21,7 +21,7 @@ export default memo(({ children, onSave }) => {
|
|
|
21
21
|
return listValues.length === 1;
|
|
22
22
|
},
|
|
23
23
|
});
|
|
24
|
-
const
|
|
24
|
+
const _saveEnabled = useValue(() => store.saveEnabled.get());
|
|
25
25
|
// onPress
|
|
26
26
|
const onPressSave = useCallback(async () => {
|
|
27
27
|
// Obtengo los valores del store
|
|
@@ -63,7 +63,7 @@ export default memo(({ children, onSave }) => {
|
|
|
63
63
|
};
|
|
64
64
|
const value = useMemo(() => ({ store, onSubmit, registerItem }), []);
|
|
65
65
|
return (<>
|
|
66
|
-
<Header saveEnabled={saveEnabled} onPressSave={onPressSave}/>
|
|
66
|
+
<Header saveEnabled={_saveEnabled && (saveEnabled ?? true)} onPressSave={onPressSave}/>
|
|
67
67
|
<Screen>
|
|
68
68
|
<Provider value={value}>
|
|
69
69
|
{children}
|
|
@@ -3,6 +3,11 @@ type Props = {
|
|
|
3
3
|
Children to be rendered inside the wrapper.
|
|
4
4
|
*/
|
|
5
5
|
children: React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
If true, the save button will be enabled.
|
|
8
|
+
This must be true and all values have to be valid.
|
|
9
|
+
*/
|
|
10
|
+
saveEnabled?: boolean;
|
|
6
11
|
/**
|
|
7
12
|
Function to be called when the user saves the changes.
|
|
8
13
|
If the function returns false, the user will not be redirected to the previous screen.
|