native-pytech 1.0.166 → 1.0.167

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.
@@ -1,17 +1,17 @@
1
1
  import { useMemo, memo, useRef, useCallback, useEffect } from "react";
2
2
  import { useValue } from "@legendapp/state/react";
3
- import { SecureField, TextField } from "@expo/ui/swift-ui";
3
+ import { SecureField, TextField, useNativeState } from "@expo/ui/swift-ui";
4
4
  import { keyboardType as keyboardTypeModifier, submitLabel, textInputAutocapitalization, onSubmit } from '@expo/ui/swift-ui/modifiers';
5
5
  import { usePage } from '../../context/page';
6
6
  export default memo(({ itemKey, defaultValue, placeholder, keyboardType, autocapitalization = true, secureTextEntry, isValid, }) => {
7
7
  const { store, registerItem, onSubmit: _onSubmit } = usePage();
8
+ const text = useNativeState(defaultValue ?? '');
8
9
  const isUniqueItem = useValue(() => store.isUniqueItem.get());
9
10
  const ref = useRef(null);
10
11
  // Key
11
12
  const keyRef = useRef(itemKey ?? 0);
12
13
  useEffect(() => {
13
14
  keyRef.current = registerItem(itemKey, ref);
14
- onValueChange(defaultValue ?? '');
15
15
  }, []);
16
16
  // onChange
17
17
  const onValueChange = useCallback((value) => {
@@ -29,8 +29,8 @@ export default memo(({ itemKey, defaultValue, placeholder, keyboardType, autocap
29
29
  ...(!autocapitalization ? [textInputAutocapitalization('never')] : []),
30
30
  onSubmit(() => _onSubmit(keyRef.current)),
31
31
  ], [keyboardType, autocapitalization, isUniqueItem]);
32
- const props = { autoFocus: isUniqueItem, modifiers, placeholder, defaultValue, onValueChange };
32
+ const props = { ref, text: text, autoFocus: isUniqueItem, modifiers, placeholder, defaultValue, onTextChange: onValueChange };
33
33
  if (secureTextEntry)
34
- return <SecureField {...props} ref={ref}/>;
35
- return <TextField {...props} ref={ref}/>;
34
+ return <SecureField {...props}/>;
35
+ return <TextField {...props}/>;
36
36
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-pytech",
3
- "version": "1.0.166",
3
+ "version": "1.0.167",
4
4
  "description": "Libreria de React Native Pytech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",