native-pytech 1.0.93 → 1.0.94
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/index.d.ts +4 -4
- package/dist/libs/editPage/index.js +5 -5
- package/dist/libs/editPage/src/components/Item/index.d.ts +3 -3
- package/dist/libs/editPage/src/components/Item/index.ios.d.ts +4 -0
- package/dist/libs/editPage/src/components/Item/index.ios.js +12 -0
- package/dist/libs/editPage/src/components/Item/index.js +1 -12
- package/dist/libs/editPage/src/components/ItemDate/index.d.ts +3 -3
- package/dist/libs/editPage/src/components/ItemDate/index.ios.d.ts +4 -0
- package/dist/libs/editPage/src/components/ItemDate/index.ios.js +26 -0
- package/dist/libs/editPage/src/components/ItemDate/index.js +1 -26
- package/dist/libs/editPage/src/components/Screen/index.d.ts +4 -0
- package/dist/libs/editPage/src/components/Screen/index.ios.d.ts +4 -0
- package/dist/libs/editPage/src/components/Screen/index.ios.js +8 -0
- package/dist/libs/editPage/src/components/Screen/index.js +1 -0
- package/dist/libs/editPage/src/components/TextField/index.d.ts +3 -3
- package/dist/libs/editPage/src/components/TextField/index.ios.d.ts +4 -0
- package/dist/libs/editPage/src/components/TextField/index.ios.js +52 -0
- package/dist/libs/editPage/src/components/TextField/index.js +1 -55
- package/dist/libs/editPage/src/components/TextField/types.d.ts +1 -2
- package/dist/libs/editPage/src/components/{Page → Wrapper}/index.js +8 -12
- package/dist/libs/editPage/src/components/Wrapper/types.d.ts +27 -0
- package/dist/libs/editPage/src/components/Wrapper/types.js +1 -0
- package/dist/libs/editPage/src/context/page.d.ts +2 -2
- package/package.json +1 -1
- /package/dist/libs/editPage/src/components/{Page → Screen}/types.d.ts +0 -0
- /package/dist/libs/editPage/src/components/{Page → Screen}/types.js +0 -0
- /package/dist/libs/editPage/src/components/{Page → Wrapper}/index.d.ts +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Wrapper from './src/components/Wrapper';
|
|
2
2
|
import Item from './src/components/Item';
|
|
3
3
|
import ItemDate from './src/components/ItemDate';
|
|
4
|
-
type
|
|
4
|
+
type Component = typeof Wrapper & {
|
|
5
5
|
Item: typeof Item;
|
|
6
6
|
ItemDate: typeof ItemDate;
|
|
7
7
|
};
|
|
8
|
-
declare const
|
|
9
|
-
export default
|
|
8
|
+
declare const Screen: Component;
|
|
9
|
+
export default Screen;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Wrapper from './src/components/Wrapper';
|
|
2
2
|
import Item from './src/components/Item';
|
|
3
3
|
import ItemDate from './src/components/ItemDate';
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export default
|
|
4
|
+
const Screen = Wrapper;
|
|
5
|
+
Screen.Item = Item;
|
|
6
|
+
Screen.ItemDate = ItemDate;
|
|
7
|
+
export default Screen;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
declare const _default: ({ ...props }: {
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
}) => any;
|
|
4
4
|
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HStack, Spacer, Text } from '@expo/ui/swift-ui';
|
|
2
|
+
import React, { memo } from 'react';
|
|
3
|
+
import TextField from '../TextField';
|
|
4
|
+
export default memo(({ label, minLengthSpacer, ...textFieldProps }) => {
|
|
5
|
+
if (!label)
|
|
6
|
+
return <TextField {...textFieldProps}/>;
|
|
7
|
+
return (<HStack>
|
|
8
|
+
<Text>{label}</Text>
|
|
9
|
+
<Spacer minLength={minLengthSpacer}/>
|
|
10
|
+
<TextField {...textFieldProps}/>
|
|
11
|
+
</HStack>);
|
|
12
|
+
});
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { memo } from 'react';
|
|
3
|
-
import TextField from '../TextField';
|
|
4
|
-
export default memo(({ label, minLengthSpacer, ...textFieldProps }) => {
|
|
5
|
-
if (!label)
|
|
6
|
-
return <TextField {...textFieldProps}/>;
|
|
7
|
-
return (<HStack>
|
|
8
|
-
<Text>{label}</Text>
|
|
9
|
-
<Spacer minLength={minLengthSpacer}/>
|
|
10
|
-
<TextField {...textFieldProps}/>
|
|
11
|
-
</HStack>);
|
|
12
|
-
});
|
|
1
|
+
export default ({ ...props }) => null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
declare const _default: ({ ...props }: {
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
}) => any;
|
|
4
4
|
export default _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Section, DatePicker } from '@expo/ui/swift-ui';
|
|
2
|
+
import React, { memo, useCallback, useEffect, useState } from 'react';
|
|
3
|
+
import { environment } from '@expo/ui/swift-ui/modifiers';
|
|
4
|
+
import { usePage } from '../../context/page';
|
|
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
|
+
const { store } = usePage();
|
|
8
|
+
const { index } = useItem();
|
|
9
|
+
const [selection, setSelection] = useState(defaultValue);
|
|
10
|
+
// Hooks
|
|
11
|
+
useEffect(() => setSelection(defaultValue), [defaultValue]);
|
|
12
|
+
const onValueChange = useCallback((value) => {
|
|
13
|
+
setSelection(value);
|
|
14
|
+
store.values[index].set({
|
|
15
|
+
value: value,
|
|
16
|
+
hasChanged: value.getTime() !== defaultValue?.getTime(),
|
|
17
|
+
isValid: true,
|
|
18
|
+
});
|
|
19
|
+
}, []);
|
|
20
|
+
return (<Section>
|
|
21
|
+
<DatePicker title={label} selection={selection} onDateChange={onValueChange} modifiers={[environment('locale', 'es_ES')]} range={{
|
|
22
|
+
start: minDate,
|
|
23
|
+
end: maxDate,
|
|
24
|
+
}}/>
|
|
25
|
+
</Section>);
|
|
26
|
+
});
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { memo, useCallback, useEffect, useState } from 'react';
|
|
3
|
-
import { environment } from '@expo/ui/swift-ui/modifiers';
|
|
4
|
-
import { usePage } from '../../context/page';
|
|
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
|
-
const { store } = usePage();
|
|
8
|
-
const { index } = useItem();
|
|
9
|
-
const [selection, setSelection] = useState(defaultValue);
|
|
10
|
-
// Hooks
|
|
11
|
-
useEffect(() => setSelection(defaultValue), [defaultValue]);
|
|
12
|
-
const onValueChange = useCallback((value) => {
|
|
13
|
-
setSelection(value);
|
|
14
|
-
store.values[index].set({
|
|
15
|
-
value: value,
|
|
16
|
-
hasChanged: value.getTime() !== defaultValue?.getTime(),
|
|
17
|
-
isValid: true,
|
|
18
|
-
});
|
|
19
|
-
}, []);
|
|
20
|
-
return (<Section>
|
|
21
|
-
<DatePicker title={label} selection={selection} onDateChange={onValueChange} modifiers={[environment('locale', 'es_ES')]} range={{
|
|
22
|
-
start: minDate,
|
|
23
|
-
end: maxDate,
|
|
24
|
-
}}/>
|
|
25
|
-
</Section>);
|
|
26
|
-
});
|
|
1
|
+
export default ({ ...props }) => null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default ({ children }) => null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
declare const _default: ({ ...props }: {
|
|
2
|
+
[x: string]: any;
|
|
3
|
+
}) => any;
|
|
4
4
|
export default _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { useMemo, memo, useRef, useCallback, useEffect } from "react";
|
|
2
|
+
import { SecureField, TextField } from "@expo/ui/swift-ui";
|
|
3
|
+
import { keyboardType as keyboardTypeModifier, submitLabel, textInputAutocapitalization, onSubmit } from '@expo/ui/swift-ui/modifiers';
|
|
4
|
+
import { usePage } from '../../context/page';
|
|
5
|
+
import { useItem } from '../../context/item';
|
|
6
|
+
export default memo(({ defaultValue, placeholder, keyboardType, autocapitalization = true, secureTextEntry, isValid, }) => {
|
|
7
|
+
const { store, isUniqueItem, saveEnabledRef, onPressSave, textFieldsRefs } = usePage();
|
|
8
|
+
const { index, nextIndex } = useItem();
|
|
9
|
+
const ref = useRef(null);
|
|
10
|
+
textFieldsRefs.current[index] = ref;
|
|
11
|
+
useEffect(() => store.values[index].value.set(defaultValue), [defaultValue]);
|
|
12
|
+
// onChange
|
|
13
|
+
const onValueChange = useCallback((value) => {
|
|
14
|
+
const _value = value.trim() === '' ? null : value.trim();
|
|
15
|
+
store.values[index].set({
|
|
16
|
+
value: _value,
|
|
17
|
+
hasChanged: _value !== defaultValue,
|
|
18
|
+
isValid: isValid?.(_value) ?? true,
|
|
19
|
+
});
|
|
20
|
+
}, []);
|
|
21
|
+
const _onSubmit = useCallback(() => {
|
|
22
|
+
// Guarda los cambios
|
|
23
|
+
if (isUniqueItem) {
|
|
24
|
+
const saveEnabled = saveEnabledRef.current;
|
|
25
|
+
if (!saveEnabled)
|
|
26
|
+
return;
|
|
27
|
+
onPressSave();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
// Va al siguiente campo
|
|
31
|
+
if (!nextIndex)
|
|
32
|
+
return;
|
|
33
|
+
textFieldsRefs.current[nextIndex].current?.focus();
|
|
34
|
+
}, []);
|
|
35
|
+
// Props
|
|
36
|
+
const modifiers = useMemo(() => [
|
|
37
|
+
...(isUniqueItem ? [submitLabel('done')] : []),
|
|
38
|
+
...(keyboardType ? [keyboardTypeModifier(keyboardType)] : []),
|
|
39
|
+
...(!autocapitalization ? [textInputAutocapitalization('never')] : []),
|
|
40
|
+
onSubmit(_onSubmit),
|
|
41
|
+
], [keyboardType, autocapitalization, isUniqueItem]);
|
|
42
|
+
const props = {
|
|
43
|
+
autoFocus: isUniqueItem,
|
|
44
|
+
modifiers,
|
|
45
|
+
placeholder,
|
|
46
|
+
defaultValue,
|
|
47
|
+
onValueChange,
|
|
48
|
+
};
|
|
49
|
+
if (secureTextEntry)
|
|
50
|
+
return <SecureField {...props} ref={ref}/>;
|
|
51
|
+
return <TextField {...props} ref={ref}/>;
|
|
52
|
+
});
|
|
@@ -1,55 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { SecureField, TextField } from "@expo/ui/swift-ui";
|
|
3
|
-
import { keyboardType as keyboardTypeModifier, submitLabel, textInputAutocapitalization, onSubmit } from '@expo/ui/swift-ui/modifiers';
|
|
4
|
-
import { usePage } from '../../context/page';
|
|
5
|
-
import { useItem } from '../../context/item';
|
|
6
|
-
export default memo(({ defaultValue, placeholder, keyboardType, autocapitalization = true, secureTextEntry, isValid, }) => {
|
|
7
|
-
// ------------------- Variables -------------------
|
|
8
|
-
const { store, isUniqueItem, saveEnabledRef, onPressSave, textFieldsRefs } = usePage();
|
|
9
|
-
const { index, nextIndex } = useItem();
|
|
10
|
-
const ref = useRef(null);
|
|
11
|
-
textFieldsRefs.current[index] = ref;
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
store.values[index].value.set(defaultValue);
|
|
14
|
-
}, [defaultValue]);
|
|
15
|
-
// -------------------- Functions --------------------
|
|
16
|
-
const onValueChange = useCallback((value) => {
|
|
17
|
-
const _value = value.trim() === '' ? null : value.trim();
|
|
18
|
-
store.values[index].set({
|
|
19
|
-
value: _value,
|
|
20
|
-
hasChanged: _value !== defaultValue,
|
|
21
|
-
isValid: isValid?.(_value) ?? true,
|
|
22
|
-
});
|
|
23
|
-
}, []);
|
|
24
|
-
const _onSubmit = useCallback(() => {
|
|
25
|
-
// Guarda los cambios
|
|
26
|
-
if (isUniqueItem) {
|
|
27
|
-
const saveEnabled = saveEnabledRef.current;
|
|
28
|
-
if (!saveEnabled)
|
|
29
|
-
return;
|
|
30
|
-
onPressSave();
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
// Va al siguiente campo
|
|
34
|
-
if (!nextIndex)
|
|
35
|
-
return;
|
|
36
|
-
textFieldsRefs.current[nextIndex].current?.focus();
|
|
37
|
-
}, []);
|
|
38
|
-
// -------------------- Props --------------------
|
|
39
|
-
const modifiers = useMemo(() => [
|
|
40
|
-
...(isUniqueItem ? [submitLabel('done')] : []),
|
|
41
|
-
...(keyboardType ? [keyboardTypeModifier(keyboardType)] : []),
|
|
42
|
-
...(!autocapitalization ? [textInputAutocapitalization('never')] : []),
|
|
43
|
-
onSubmit(_onSubmit),
|
|
44
|
-
], [keyboardType, autocapitalization, isUniqueItem]);
|
|
45
|
-
const props = useMemo(() => ({
|
|
46
|
-
autoFocus: isUniqueItem,
|
|
47
|
-
modifiers,
|
|
48
|
-
placeholder,
|
|
49
|
-
defaultValue,
|
|
50
|
-
onValueChange,
|
|
51
|
-
}), [modifiers, placeholder, defaultValue]);
|
|
52
|
-
if (secureTextEntry)
|
|
53
|
-
return <SecureField {...props} ref={ref}/>;
|
|
54
|
-
return <TextField {...props} ref={ref}/>;
|
|
55
|
-
});
|
|
1
|
+
export default ({ ...props }) => null;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { keyboardType } from "@expo/ui/swift-ui/modifiers";
|
|
2
1
|
type Props = {
|
|
3
2
|
/**
|
|
4
3
|
Default value of the text field.
|
|
@@ -11,7 +10,7 @@ type Props = {
|
|
|
11
10
|
/**
|
|
12
11
|
Keyboard type. Uses the keyboardType modifier.
|
|
13
12
|
*/
|
|
14
|
-
keyboardType?:
|
|
13
|
+
keyboardType?: "default" | "email-address" | "numeric" | "phone-pad" | "ascii-capable" | "numbers-and-punctuation" | "url" | "name-phone-pad" | "decimal-pad" | "twitter" | "web-search" | "ascii-capable-number-pad";
|
|
15
14
|
/**
|
|
16
15
|
If true, the text field will be autocapitalized. Uses the textInputAutocapitalization modifier.
|
|
17
16
|
@default true
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Host, List, Section } from '@expo/ui/swift-ui';
|
|
2
1
|
import { useObservable, useValue } from '@legendapp/state/react';
|
|
3
2
|
import { Stack, useRouter } from 'expo-router';
|
|
4
3
|
import React, { memo, useCallback, useMemo, useRef } from 'react';
|
|
5
4
|
import Hooks from '../../../../../libs/constants/hooks';
|
|
6
5
|
import { Provider } from '../../context/page';
|
|
7
6
|
import { Provider as ItemProvider } from '../../context/item';
|
|
7
|
+
import Screen from '../Screen';
|
|
8
8
|
function Component({ data = [], renderItem, onSave, }) {
|
|
9
9
|
const router = useRouter();
|
|
10
10
|
const saveEnabledRef = useRef(false);
|
|
@@ -54,21 +54,17 @@ function Component({ data = [], renderItem, onSave, }) {
|
|
|
54
54
|
</Stack.Toolbar.Button>
|
|
55
55
|
</Stack.Toolbar>
|
|
56
56
|
|
|
57
|
-
<
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
<Provider value={value}>
|
|
61
|
-
{data.map((item, index) => {
|
|
57
|
+
<Screen>
|
|
58
|
+
<Provider value={value}>
|
|
59
|
+
{data.map((item, index) => {
|
|
62
60
|
const nextIndex = index + 1;
|
|
63
61
|
const value = { index, nextIndex: nextIndex < data.length ? nextIndex : undefined };
|
|
64
62
|
return (<ItemProvider key={index} value={value}>
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
{renderItem?.(item)}
|
|
64
|
+
</ItemProvider>);
|
|
67
65
|
})}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
</List>
|
|
71
|
-
</Host>
|
|
66
|
+
</Provider>
|
|
67
|
+
</Screen>
|
|
72
68
|
</>);
|
|
73
69
|
}
|
|
74
70
|
export default memo(Component);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type Props<T> = {
|
|
2
|
+
/**
|
|
3
|
+
The data items to be rendered inside the list.
|
|
4
|
+
@default []
|
|
5
|
+
*/
|
|
6
|
+
data?: T[];
|
|
7
|
+
/**
|
|
8
|
+
The function to render the item.
|
|
9
|
+
*/
|
|
10
|
+
renderItem?: (item: T) => React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
Function to be called when the user saves the changes.
|
|
13
|
+
If the function returns false, the user will not be redirected to the previous screen.
|
|
14
|
+
*/
|
|
15
|
+
onSave?: (values: (string | null | Date)[]) => boolean | Promise<boolean>;
|
|
16
|
+
};
|
|
17
|
+
export type Value = {
|
|
18
|
+
value: string | null | Date | undefined;
|
|
19
|
+
hasChanged: boolean;
|
|
20
|
+
isValid: boolean;
|
|
21
|
+
};
|
|
22
|
+
export type Values = Record<number, Value>;
|
|
23
|
+
export type Store = {
|
|
24
|
+
values: Values;
|
|
25
|
+
saveEnabled: boolean;
|
|
26
|
+
};
|
|
27
|
+
export default Props;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Observable } from '@legendapp/state';
|
|
2
2
|
import { TextFieldRef } from '@expo/ui/swift-ui';
|
|
3
|
-
import
|
|
4
|
-
import type { Store } from '../components/
|
|
3
|
+
import { RefObject } from 'react';
|
|
4
|
+
import type { Store } from '../components/Wrapper/types';
|
|
5
5
|
export type TextFieldsRefsType = Record<number, RefObject<TextFieldRef | null>>;
|
|
6
6
|
export declare const Provider: import("react").Provider<{
|
|
7
7
|
store: Observable<Store>;
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|