native-pytech 1.0.151 → 1.0.152

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.
@@ -16,7 +16,11 @@ export default memo(({ itemKey, label, defaultValue, minDate = new Date(new Date
16
16
  keyRef.current = registerItem(itemKey);
17
17
  }, []);
18
18
  // Hooks
19
- useEffect(() => setSelection(defaultValue ?? new Date()), [defaultValue]);
19
+ useEffect(() => {
20
+ setSelection(defaultValue ?? new Date());
21
+ if (defaultValue === undefined)
22
+ onValueChange(Formats.dateToTextFormat(selection, 'yyyy-MM-dd'));
23
+ }, [defaultValue]);
20
24
  const onValueChange = useCallback((value_str) => {
21
25
  const [year, month, day] = value_str.split('-').map(Number);
22
26
  const value = new Date(year, month - 1, day);
@@ -27,8 +31,6 @@ export default memo(({ itemKey, label, defaultValue, minDate = new Date(new Date
27
31
  isValid: true,
28
32
  });
29
33
  }, []);
30
- if (defaultValue === undefined)
31
- onValueChange(Formats.dateToTextFormat(selection, 'yyyy-MM-dd')); // Set default value on first render
32
34
  return (<Table.Option id={label ?? ''} colorScheme={colorScheme} childrenLeft={<Table.Option.Components.Text text={label ?? 'Seleccione una fecha'}/>} childrenRight={(<>
33
35
  <Pressable onPress={() => inputRef.current?.showPicker()} style={[styles.container, { backgroundColor: Colors.especiales.azul }]}>
34
36
  <Table.Option.Components.Text text={Formats.dateToTextFormat(selection, 'dd/MM/yyyy')} style={{ color: 'white', userSelect: 'none' }}/>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-pytech",
3
- "version": "1.0.151",
3
+ "version": "1.0.152",
4
4
  "description": "Libreria de React Native Pytech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",