native-pytech 1.0.147 → 1.0.151

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.
@@ -8,7 +8,7 @@ import Colors from '../../../../../libs/constants/colors';
8
8
  export default memo(({ itemKey, label, defaultValue, minDate = new Date(new Date().setFullYear(new Date().getFullYear() - 100)), maxDate = new Date(), }) => {
9
9
  const { colorScheme } = useApp();
10
10
  const { store, registerItem } = usePage();
11
- const [selection, setSelection] = useState(defaultValue);
11
+ const [selection, setSelection] = useState(defaultValue ?? new Date());
12
12
  const inputRef = useRef(null);
13
13
  // Key
14
14
  const keyRef = useRef(itemKey);
@@ -16,7 +16,7 @@ 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), [defaultValue]);
19
+ useEffect(() => setSelection(defaultValue ?? new Date()), [defaultValue]);
20
20
  const onValueChange = useCallback((value_str) => {
21
21
  const [year, month, day] = value_str.split('-').map(Number);
22
22
  const value = new Date(year, month - 1, day);
@@ -27,10 +27,12 @@ export default memo(({ itemKey, label, defaultValue, minDate = new Date(new Date
27
27
  isValid: true,
28
28
  });
29
29
  }, []);
30
+ if (defaultValue === undefined)
31
+ onValueChange(Formats.dateToTextFormat(selection, 'yyyy-MM-dd')); // Set default value on first render
30
32
  return (<Table.Option id={label ?? ''} colorScheme={colorScheme} childrenLeft={<Table.Option.Components.Text text={label ?? 'Seleccione una fecha'}/>} childrenRight={(<>
31
33
  <Pressable onPress={() => inputRef.current?.showPicker()} style={[styles.container, { backgroundColor: Colors.especiales.azul }]}>
32
- <Table.Option.Components.Text text={selection ? Formats.dateToTextFormat(selection, 'dd/MM/yyyy') : ''} style={{ color: 'white', userSelect: 'none' }}/>
33
- <input ref={inputRef} type="date" value={selection ? Formats.dateToTextFormat(selection, 'yyyy-MM-dd') : ''} onChange={(e) => onValueChange(e.target.value)} style={{
34
+ <Table.Option.Components.Text text={Formats.dateToTextFormat(selection, 'dd/MM/yyyy')} style={{ color: 'white', userSelect: 'none' }}/>
35
+ <input ref={inputRef} type="date" value={Formats.dateToTextFormat(selection, 'yyyy-MM-dd')} onChange={(e) => onValueChange(e.target.value)} style={{
34
36
  all: 'unset',
35
37
  visibility: 'hidden',
36
38
  width: 0,
@@ -30,7 +30,7 @@ export default memo(({ children, childrenLeft, childrenRight, onPress, style, ba
30
30
  {childrenLeft && <AddTextView hasTextView={hasTextView}>{childrenLeft}</AddTextView>}
31
31
  {childrenRight || hasNavigationArrow ? (<View style={styles.der}>
32
32
  {childrenRight}
33
- {hasNavigationArrow && <Ionicons name='chevron-forward' size={24} color={colors.theme[colorScheme].icon}/>}
33
+ {hasNavigationArrow && <Ionicons name='chevron-forward' size={20} color={colors.theme[colorScheme].icon}/>}
34
34
  </View>) : null}
35
35
  {children}
36
36
  </>;
@@ -8,7 +8,13 @@ export default memo(({ ...props }) => {
8
8
  });
9
9
  const Component = memo(({ text, enabled = true, style = {}, colorScheme, fontScale, ...props }) => {
10
10
  const Theme = colors.theme[colorScheme];
11
- const textStyle = useMemo(() => [styles.text, { color: enabled ? Theme.text : Theme.text2 }, style], [enabled, Theme, style]);
11
+ const textStyle = useMemo(() => [
12
+ styles.text,
13
+ {
14
+ color: enabled ? Theme.text : Theme.text2
15
+ },
16
+ style
17
+ ], [enabled, Theme, style]);
12
18
  return (<Text$ fontScale={fontScale} style={textStyle} {...props}>
13
19
  {text}
14
20
  </Text$>);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-pytech",
3
- "version": "1.0.147",
3
+ "version": "1.0.151",
4
4
  "description": "Libreria de React Native Pytech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",