native-pytech 1.0.91 → 1.0.93
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/dist/libs/editPage/src/components/Item/types.d.ts +1 -2
- package/dist/libs/editPage/src/components/ItemDate/index.d.ts +1 -1
- package/dist/libs/editPage/src/components/ItemDate/index.js +5 -11
- package/dist/libs/editPage/src/components/ItemDate/types.d.ts +1 -2
- package/dist/libs/editPage/src/components/Page/index.js +7 -17
- package/dist/libs/editPage/src/components/Page/types.d.ts +3 -2
- package/dist/libs/pickerPage/src/Page/index.d.ts +1 -1
- package/dist/libs/pickerPage/src/Page/index.js +2 -2
- package/dist/libs/pickerPage/src/Page/types.d.ts +0 -5
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type SpacerProps } from "@expo/ui/swift-ui";
|
|
2
1
|
import type TextFieldProps from '../TextField/types';
|
|
3
2
|
type Props = TextFieldProps & {
|
|
4
3
|
/**
|
|
@@ -10,6 +9,6 @@ type Props = TextFieldProps & {
|
|
|
10
9
|
Minimum length of the spacer between the title and the text field.
|
|
11
10
|
If the title is not provided, will not be displayed.
|
|
12
11
|
*/
|
|
13
|
-
minLengthSpacer?:
|
|
12
|
+
minLengthSpacer?: number;
|
|
14
13
|
};
|
|
15
14
|
export default Props;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type Props from './types';
|
|
3
|
-
declare const _default: React.MemoExoticComponent<({ label, defaultValue, minDate, maxDate
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ label, defaultValue, minDate, maxDate }: Props) => React.JSX.Element>;
|
|
4
4
|
export default _default;
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
import { Section, DatePicker } from '@expo/ui/swift-ui';
|
|
2
|
-
import React, { memo, useCallback, useEffect,
|
|
2
|
+
import React, { memo, useCallback, useEffect, useState } from 'react';
|
|
3
3
|
import { environment } from '@expo/ui/swift-ui/modifiers';
|
|
4
4
|
import { usePage } from '../../context/page';
|
|
5
5
|
import { useItem } from '../../context/item';
|
|
6
|
-
export default memo(({ label, defaultValue, minDate = new Date(new Date().setFullYear(new Date().getFullYear() - 100)), maxDate = new Date()
|
|
7
|
-
// ------------------- Variables -------------------
|
|
6
|
+
export default memo(({ label, defaultValue, minDate = new Date(new Date().setFullYear(new Date().getFullYear() - 100)), maxDate = new Date() }) => {
|
|
8
7
|
const { store } = usePage();
|
|
9
8
|
const { index } = useItem();
|
|
10
9
|
const [selection, setSelection] = useState(defaultValue);
|
|
11
|
-
|
|
12
|
-
...(modifiers ?? []),
|
|
13
|
-
environment('locale', 'es_ES'),
|
|
14
|
-
], [modifiers]);
|
|
15
|
-
// ------------------- Hooks -------------------
|
|
10
|
+
// Hooks
|
|
16
11
|
useEffect(() => setSelection(defaultValue), [defaultValue]);
|
|
17
|
-
// -------------------- Functions --------------------
|
|
18
12
|
const onValueChange = useCallback((value) => {
|
|
19
13
|
setSelection(value);
|
|
20
14
|
store.values[index].set({
|
|
@@ -24,9 +18,9 @@ export default memo(({ label, defaultValue, minDate = new Date(new Date().setFul
|
|
|
24
18
|
});
|
|
25
19
|
}, []);
|
|
26
20
|
return (<Section>
|
|
27
|
-
<DatePicker title={label} selection={selection} onDateChange={onValueChange} modifiers={
|
|
21
|
+
<DatePicker title={label} selection={selection} onDateChange={onValueChange} modifiers={[environment('locale', 'es_ES')]} range={{
|
|
28
22
|
start: minDate,
|
|
29
23
|
end: maxDate,
|
|
30
|
-
}}
|
|
24
|
+
}}/>
|
|
31
25
|
</Section>);
|
|
32
26
|
});
|
|
@@ -6,9 +6,9 @@ import Hooks from '../../../../../libs/constants/hooks';
|
|
|
6
6
|
import { Provider } from '../../context/page';
|
|
7
7
|
import { Provider as ItemProvider } from '../../context/item';
|
|
8
8
|
function Component({ data = [], renderItem, onSave, }) {
|
|
9
|
-
// ------------------- Variables -------------------
|
|
10
9
|
const router = useRouter();
|
|
11
10
|
const saveEnabledRef = useRef(false);
|
|
11
|
+
// Store
|
|
12
12
|
const values = (data ?? []).reduce((acc, item, index) => {
|
|
13
13
|
acc[index] = {
|
|
14
14
|
value: undefined,
|
|
@@ -19,20 +19,17 @@ function Component({ data = [], renderItem, onSave, }) {
|
|
|
19
19
|
}, {});
|
|
20
20
|
const store = useObservable({
|
|
21
21
|
values: values,
|
|
22
|
-
saveEnabled: (
|
|
23
|
-
const
|
|
24
|
-
const listValues = Object.values(values);
|
|
22
|
+
saveEnabled: () => {
|
|
23
|
+
const listValues = Object.values(store.values.get());
|
|
25
24
|
const hasChanged = listValues.some(value => value.hasChanged);
|
|
26
25
|
const allValid = listValues.every(value => value.isValid);
|
|
27
26
|
return hasChanged && allValid;
|
|
28
|
-
}
|
|
27
|
+
},
|
|
29
28
|
});
|
|
30
29
|
const saveEnabled = useValue(() => store.saveEnabled.get());
|
|
31
|
-
Hooks.useEffectWithoutFirstRender(() =>
|
|
32
|
-
saveEnabledRef.current = saveEnabled;
|
|
33
|
-
}, [saveEnabled]);
|
|
30
|
+
Hooks.useEffectWithoutFirstRender(() => saveEnabledRef.current = saveEnabled, [saveEnabled]);
|
|
34
31
|
const textFieldsRefs = useRef({});
|
|
35
|
-
//
|
|
32
|
+
// onPress
|
|
36
33
|
const onPressSave = useCallback(async () => {
|
|
37
34
|
// Obtengo los valores del store
|
|
38
35
|
const values = store.values.peek();
|
|
@@ -43,14 +40,7 @@ function Component({ data = [], renderItem, onSave, }) {
|
|
|
43
40
|
return;
|
|
44
41
|
router.back();
|
|
45
42
|
}, [onSave, store.values]);
|
|
46
|
-
|
|
47
|
-
const value = useMemo(() => ({
|
|
48
|
-
store,
|
|
49
|
-
saveEnabledRef,
|
|
50
|
-
onPressSave,
|
|
51
|
-
isUniqueItem: (data?.length ?? 0) === 1,
|
|
52
|
-
textFieldsRefs
|
|
53
|
-
}), []);
|
|
43
|
+
const value = useMemo(() => ({ store, saveEnabledRef, onPressSave, isUniqueItem: (data?.length ?? 0) === 1, textFieldsRefs }), []);
|
|
54
44
|
return (<>
|
|
55
45
|
<Stack.Toolbar placement="left">
|
|
56
46
|
<Stack.Toolbar.Button onPress={() => router.back()}>
|
|
@@ -14,11 +14,12 @@ type Props<T> = {
|
|
|
14
14
|
*/
|
|
15
15
|
onSave?: (values: (string | null | Date)[]) => boolean | Promise<boolean>;
|
|
16
16
|
};
|
|
17
|
-
export type
|
|
17
|
+
export type Value = {
|
|
18
18
|
value: string | null | Date | undefined;
|
|
19
19
|
hasChanged: boolean;
|
|
20
20
|
isValid: boolean;
|
|
21
|
-
}
|
|
21
|
+
};
|
|
22
|
+
export type Values = Record<number, Value>;
|
|
22
23
|
export type Store = {
|
|
23
24
|
values: Values;
|
|
24
25
|
saveEnabled: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type Props from './types';
|
|
3
|
-
declare const _default: React.MemoExoticComponent<({ children, onChangeSearchText, onSelectionChange, placeholderSearchBar,
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ children, onChangeSearchText, onSelectionChange, placeholderSearchBar, ...props }: Props) => React.JSX.Element>;
|
|
4
4
|
export default _default;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Stack, router } from "expo-router";
|
|
2
2
|
import React, { memo } from "react";
|
|
3
3
|
import Content from '../Content';
|
|
4
|
-
export default memo(({ children, onChangeSearchText, onSelectionChange, placeholderSearchBar = 'Buscar',
|
|
4
|
+
export default memo(({ children, onChangeSearchText, onSelectionChange, placeholderSearchBar = 'Buscar', ...props }) => {
|
|
5
5
|
const _onSelectionChange = async (selection) => {
|
|
6
6
|
await onSelectionChange?.(selection);
|
|
7
7
|
router.back();
|
|
8
8
|
};
|
|
9
9
|
return (<>
|
|
10
10
|
<Stack.Toolbar placement="right">
|
|
11
|
-
<Stack.Toolbar.Button onPress={
|
|
11
|
+
<Stack.Toolbar.Button onPress={() => router.back()}>
|
|
12
12
|
<Stack.Toolbar.Icon sf="xmark"/>
|
|
13
13
|
</Stack.Toolbar.Button>
|
|
14
14
|
</Stack.Toolbar>
|
|
@@ -20,11 +20,6 @@ type Props = {
|
|
|
20
20
|
@default 'Buscar'
|
|
21
21
|
*/
|
|
22
22
|
placeholderSearchBar?: string;
|
|
23
|
-
/**
|
|
24
|
-
Function to be called when the user press the cancel button on the header.
|
|
25
|
-
@default () => router.back()
|
|
26
|
-
*/
|
|
27
|
-
onPressHeaderCancel?: () => void;
|
|
28
23
|
/**
|
|
29
24
|
Adjusts the row insets on ios.
|
|
30
25
|
Is is useful when uses items with gradients.
|