native-pytech 1.0.102 → 1.0.104

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,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import type Props from './types';
3
- declare const _default: React.MemoExoticComponent<({ children, systemImage, label, modifiers, maintainButtonStyle, textTrailing, textTrailingProps, hStackProps, ...buttonProps }: Props) => React.JSX.Element>;
3
+ declare const _default: React.MemoExoticComponent<({ children, onPress, icon, label, systemImage, listRowInsets, trailingText, trailingTextProps }: Props) => React.JSX.Element>;
4
4
  export default _default;
@@ -1,23 +1,13 @@
1
1
  import { Button, HStack, Label } from '@expo/ui/swift-ui';
2
- import { foregroundStyle } from '@expo/ui/swift-ui/modifiers';
3
- import { Color } from 'expo-router';
2
+ import { listRowInsets as listRowInsetsModifier } from '@expo/ui/swift-ui/modifiers';
4
3
  import React, { memo, useMemo } from 'react';
5
4
  import Trailing from './Trailing';
6
- export default memo(({ children, systemImage, label, modifiers, maintainButtonStyle = false, textTrailing, textTrailingProps, hStackProps, ...buttonProps }) => {
7
- // Va a poner una Label cuando no tenga que mantener el estilo del button y haya una imagen.
8
- // Si no tiene que mantener el estilo del button y no hay una imagen, solo va a cambiar el foregroundColor.
9
- const renderLabel = !maintainButtonStyle && systemImage !== undefined;
10
- const _modifiers = useMemo(() => [
11
- ...(modifiers ?? []),
12
- ...(!maintainButtonStyle && !renderLabel ? [foregroundStyle(Color.ios.label)] : []),
13
- ], [modifiers, maintainButtonStyle, renderLabel]);
14
- const buttonSystemImage = !renderLabel ? systemImage : undefined;
15
- const buttonLabel = !renderLabel ? label : undefined;
16
- return (<HStack {...hStackProps}>
17
- <Button modifiers={_modifiers} systemImage={buttonSystemImage} label={buttonLabel} {...buttonProps}>
18
- {children}
5
+ export default memo(({ children, onPress, icon, label, systemImage, listRowInsets = false, trailingText, trailingTextProps }) => {
6
+ const modifiers = useMemo(() => listRowInsets ? [listRowInsetsModifier({ top: 20, bottom: 20, leading: 25, trailing: 20 })] : [], [listRowInsets]);
7
+ return (<HStack modifiers={modifiers}>
8
+ <Button onPress={onPress}>
9
+ {children ?? <Label title={label} systemImage={systemImage} icon={icon}/>}
19
10
  </Button>
20
- {!children && renderLabel && (<Label title={label} systemImage={systemImage}/>)}
21
- <Trailing text={textTrailing} textProps={textTrailingProps}/>
11
+ <Trailing text={trailingText} textProps={trailingTextProps}/>
22
12
  </HStack>);
23
13
  });
@@ -1,4 +1,4 @@
1
- import { ButtonProps, HStackProps, TextProps } from "@expo/ui/swift-ui";
1
+ import { ButtonProps, LabelProps, TextProps } from "@expo/ui/swift-ui";
2
2
  export type TrailingProps = {
3
3
  /**
4
4
  Text to display on the Trailing Stack.
@@ -9,23 +9,23 @@ export type TrailingProps = {
9
9
  */
10
10
  textProps?: TextProps;
11
11
  };
12
- type Props = ButtonProps & {
12
+ type Props = Pick<ButtonProps, 'children' | 'onPress' | 'systemImage' | 'label'> & {
13
13
  /**
14
- Text to display on the Trailing Stack.
14
+ Whether to apply the listRowInsets modifier to the HStack.
15
+ @default false
15
16
  */
16
- textTrailing?: TrailingProps['text'];
17
+ listRowInsets?: boolean;
17
18
  /**
18
- TextProps to apply to the Trailing Stack text.
19
+ Icon to display on the Label.
19
20
  */
20
- textTrailingProps?: TrailingProps['textProps'];
21
+ icon?: LabelProps['icon'];
21
22
  /**
22
- false: Renders a Label if systemImage is provided, otherwise put a foregroundStyle(Color.ios.label) modifier.
23
- @default false
23
+ Text to display on the Trailing Stack.
24
24
  */
25
- maintainButtonStyle?: boolean;
25
+ trailingText?: TrailingProps['text'];
26
26
  /**
27
- HStackProps to apply to the HStack.
27
+ TextProps to apply to the Trailing Stack text.
28
28
  */
29
- hStackProps?: Omit<HStackProps, 'children'>;
29
+ trailingTextProps?: TrailingProps['textProps'];
30
30
  };
31
31
  export default Props;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-pytech",
3
- "version": "1.0.102",
3
+ "version": "1.0.104",
4
4
  "description": "Libreria de React Native Pytech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",