native-pytech 1.0.96 → 1.0.98
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/index.d.ts +2 -3
- package/dist/libs/editPage/src/components/ItemDate/index.d.ts +2 -3
- package/dist/libs/editPage/src/components/ItemDate/index.ios.js +7 -3
- package/dist/libs/editPage/src/components/TextField/index.d.ts +2 -3
- package/dist/libs/editPage/src/components/TextField/index.ios.js +8 -5
- package/package.json +1 -1
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { Section, DatePicker } from '@expo/ui/swift-ui';
|
|
2
|
-
import React, { memo, useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import React, { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { environment } from '@expo/ui/swift-ui/modifiers';
|
|
4
4
|
import { usePage } from '../../context/page';
|
|
5
5
|
export default memo(({ itemKey, label, defaultValue, minDate = new Date(new Date().setFullYear(new Date().getFullYear() - 100)), maxDate = new Date(), }) => {
|
|
6
6
|
const { store, registerItem } = usePage();
|
|
7
|
-
const key = registerItem(itemKey);
|
|
8
7
|
const [selection, setSelection] = useState(defaultValue);
|
|
8
|
+
// Key
|
|
9
|
+
const keyRef = useRef(itemKey);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
keyRef.current = registerItem(itemKey);
|
|
12
|
+
}, []);
|
|
9
13
|
// Hooks
|
|
10
14
|
useEffect(() => setSelection(defaultValue), [defaultValue]);
|
|
11
15
|
const onValueChange = useCallback((value) => {
|
|
12
16
|
setSelection(value);
|
|
13
|
-
store.values[
|
|
17
|
+
store.values[keyRef.current].set({
|
|
14
18
|
value: value,
|
|
15
19
|
hasChanged: value.getTime() !== defaultValue?.getTime(),
|
|
16
20
|
isValid: true,
|
|
@@ -7,13 +7,16 @@ export default memo(({ itemKey, defaultValue, placeholder, keyboardType, autocap
|
|
|
7
7
|
const { store, registerItem, onSubmit: _onSubmit } = usePage();
|
|
8
8
|
const isUniqueItem = useValue(() => store.isUniqueItem.get());
|
|
9
9
|
const ref = useRef(null);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
// Key
|
|
11
|
+
const keyRef = useRef(itemKey);
|
|
12
|
+
console.log('keyRef', keyRef.current);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
keyRef.current = registerItem(itemKey, ref);
|
|
15
|
+
}, []);
|
|
13
16
|
// onChange
|
|
14
17
|
const onValueChange = useCallback((value) => {
|
|
15
18
|
const _value = value.trim() === '' ? null : value.trim();
|
|
16
|
-
store.values[
|
|
19
|
+
store.values[keyRef.current].set({
|
|
17
20
|
value: _value,
|
|
18
21
|
hasChanged: _value !== defaultValue,
|
|
19
22
|
isValid: isValid?.(_value) ?? true,
|
|
@@ -24,7 +27,7 @@ export default memo(({ itemKey, defaultValue, placeholder, keyboardType, autocap
|
|
|
24
27
|
...(isUniqueItem ? [submitLabel('done')] : []),
|
|
25
28
|
...(keyboardType ? [keyboardTypeModifier(keyboardType)] : []),
|
|
26
29
|
...(!autocapitalization ? [textInputAutocapitalization('never')] : []),
|
|
27
|
-
onSubmit(() => _onSubmit(
|
|
30
|
+
onSubmit(() => _onSubmit(keyRef.current)),
|
|
28
31
|
], [keyboardType, autocapitalization, isUniqueItem]);
|
|
29
32
|
const props = { autoFocus: isUniqueItem, modifiers, placeholder, defaultValue, onValueChange };
|
|
30
33
|
if (secureTextEntry)
|