native-pytech 1.0.151 → 1.0.153
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(() =>
|
|
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' }}/>
|
|
@@ -9,7 +9,7 @@ import { isLowTier } from '../../../../../libs/constants/consts';
|
|
|
9
9
|
import { BordersProvider, StoreProvider, TableProvider } from '../../context/table';
|
|
10
10
|
import OptionWrapper from '../OptionWrapper';
|
|
11
11
|
import Detail from '../Detail';
|
|
12
|
-
const Table = memo(({ children, title, renderDetail, colorThemeType = 'default', type = 'default', style, contentContainerStyle, allBorders = false, keys, }) => {
|
|
12
|
+
const Table = memo(({ children, title, renderDetail, colorThemeType = 'default', type = 'default', style, contentContainerStyle, allBorders = false, keys, disableLayoutAnimation }) => {
|
|
13
13
|
// ------------- Variables -------------
|
|
14
14
|
const { colorScheme } = useApp();
|
|
15
15
|
const Theme = colors.theme[colorScheme];
|
|
@@ -30,7 +30,7 @@ const Table = memo(({ children, title, renderDetail, colorThemeType = 'default',
|
|
|
30
30
|
},
|
|
31
31
|
borders: new Map()
|
|
32
32
|
});
|
|
33
|
-
const layoutAnimation = isLowTier ? LinearTransition.duration(500) : LinearTransition.easing(Easing.bezier(0.2, 0.2, 0, 1)).duration(600);
|
|
33
|
+
const layoutAnimation = disableLayoutAnimation ? undefined : (isLowTier ? LinearTransition.duration(500) : LinearTransition.easing(Easing.bezier(0.2, 0.2, 0, 1)).duration(600));
|
|
34
34
|
// ------------- useEffect -------------
|
|
35
35
|
Hooks.useEffectWithoutFirstRender(() => store.deleted.keys.set(keys), [keys]);
|
|
36
36
|
const value = useMemo(() => ({ colorThemeType, type, keys, allBorders }), [colorThemeType, type, keys, allBorders]);
|
|
@@ -48,6 +48,10 @@ type Props = {
|
|
|
48
48
|
Se muestran todos los bottom y el top del primero
|
|
49
49
|
*/
|
|
50
50
|
allBorders?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
Si le aplica la layoutAnimation.
|
|
53
|
+
*/
|
|
54
|
+
disableLayoutAnimation?: boolean;
|
|
51
55
|
};
|
|
52
56
|
export type Component = React.MemoExoticComponent<React.FC<Props>> & {
|
|
53
57
|
Option: typeof OptionWrapper;
|