native-pytech 1.0.176 → 1.0.178

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.
@@ -2,13 +2,14 @@ import { Section, DatePicker } from '@expo/ui/swift-ui';
2
2
  import { 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
- export default memo(({ itemKey, label, defaultValue, minDate = new Date(new Date().setFullYear(new Date().getFullYear() - 100)), maxDate = new Date(), onValueChange, }) => {
5
+ export default memo(({ itemKey, label, defaultValue, minDate, maxDate, onValueChange, }) => {
6
6
  const { store, registerItem } = usePage();
7
7
  const [selection, setSelection] = useState(defaultValue);
8
8
  // Key
9
9
  const keyRef = useRef(itemKey);
10
10
  useEffect(() => {
11
11
  keyRef.current = registerItem(itemKey);
12
+ _onValueChange(selection ?? new Date());
12
13
  }, []);
13
14
  // Hooks
14
15
  useEffect(() => setSelection(defaultValue), [defaultValue]);
@@ -5,7 +5,7 @@ import { useApp } from '../../../../../libs/providers/App';
5
5
  import Formats from '../../../../../libs/constants/formats';
6
6
  import { usePage } from '../../context/page';
7
7
  import Colors from '../../../../../libs/constants/colors';
8
- export default memo(({ itemKey, label, defaultValue, minDate = new Date(new Date().setFullYear(new Date().getFullYear() - 100)), maxDate = new Date(), onValueChange, }) => {
8
+ export default memo(({ itemKey, label, defaultValue, minDate, maxDate, onValueChange, }) => {
9
9
  const { colorScheme } = useApp();
10
10
  const { store, registerItem } = usePage();
11
11
  const [selection, setSelection] = useState(defaultValue ?? new Date());
@@ -14,6 +14,7 @@ export default memo(({ itemKey, label, defaultValue, minDate = new Date(new Date
14
14
  const keyRef = useRef(itemKey);
15
15
  useEffect(() => {
16
16
  keyRef.current = registerItem(itemKey);
17
+ _onValueChange(Formats.dateToTextFormat(selection, 'yyyy-MM-dd'));
17
18
  }, []);
18
19
  // Hooks
19
20
  useEffect(() => {
@@ -13,12 +13,10 @@ type Props = {
13
13
  defaultValue?: Date;
14
14
  /**
15
15
  Minimum date allowed.
16
- @default 100 years ago
17
16
  */
18
17
  minDate?: Date;
19
18
  /**
20
19
  Maximum date allowed.
21
- @default today
22
20
  */
23
21
  maxDate?: Date;
24
22
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-pytech",
3
- "version": "1.0.176",
3
+ "version": "1.0.178",
4
4
  "description": "Libreria de React Native Pytech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",