native-pytech 1.0.38 → 1.0.41

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.
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type Props from './types';
3
+ declare const _default: React.MemoExoticComponent<({ text, color, type, systemName }: Props) => React.JSX.Element>;
4
+ export default _default;
@@ -0,0 +1,33 @@
1
+ import React, { memo, useMemo } from 'react';
2
+ import { StyleSheet, Text } from 'react-native';
3
+ import { LinearGradient } from 'expo-linear-gradient';
4
+ import colors, { sizes } from '../../constants';
5
+ import Icon from '../Icon';
6
+ export default memo(({ text, color, type = 'small', systemName }) => {
7
+ const typeSizes = useMemo(() => sizes[type], [type]);
8
+ const textComponent = useMemo(() => {
9
+ const cantLetras = text?.length;
10
+ if (!text || !cantLetras || systemName)
11
+ return null;
12
+ if (cantLetras > 3)
13
+ throw new Error('Text must be less than 3 characters');
14
+ return (<Text style={[styles.text, { fontSize: typeSizes.fontSize[cantLetras] }]} allowFontScaling={false}>
15
+ {text}
16
+ </Text>);
17
+ }, [text, typeSizes]);
18
+ return (<LinearGradient style={[styles.gradient, { height: typeSizes.diameter, borderRadius: typeSizes.diameter }]} colors={[colors[color].light, colors[color].dark]} start={{ x: 0, y: 0 }} end={{ x: 0, y: 1 }}>
19
+ {textComponent ?? (systemName && <Icon systemName={systemName}/>)}
20
+ </LinearGradient>);
21
+ });
22
+ const styles = StyleSheet.create({
23
+ gradient: {
24
+ aspectRatio: 1, // width will automatically match height
25
+ justifyContent: 'center',
26
+ alignItems: 'center'
27
+ },
28
+ text: {
29
+ color: 'white',
30
+ fontWeight: 'bold',
31
+ letterSpacing: -0.5,
32
+ }
33
+ });
@@ -0,0 +1,19 @@
1
+ import colors, { sizesType } from '../../constants';
2
+ import IconProps from '../Icon/types';
3
+ export type Props = IconProps & {
4
+ /**
5
+ The text to display in the gradient.
6
+ Must be less than 3 characters.
7
+ */
8
+ text?: string;
9
+ /**
10
+ The color of the gradient.
11
+ */
12
+ color: keyof typeof colors;
13
+ /**
14
+ The size of the gradient.
15
+ @default 'small'
16
+ */
17
+ type: sizesType;
18
+ };
19
+ export default Props;
@@ -0,0 +1,3 @@
1
+ import type Props from './types';
2
+ declare const _default: ({ systemName, iconSize }: Props) => any;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import type Props from './types';
2
+ declare const _default: ({ systemName, iconSize }: Props) => import("react").JSX.Element;
3
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { Host, Image } from '@expo/ui/swift-ui';
2
+ export default ({ systemName, iconSize = 100 }) => {
3
+ return (<Host matchContents>
4
+ <Image systemName={systemName} color='white' size={iconSize}/>
5
+ </Host>);
6
+ };
@@ -0,0 +1 @@
1
+ export default ({ systemName, iconSize = 100 }) => null;
@@ -0,0 +1,16 @@
1
+ import { type SFSymbol } from 'sf-symbols-typescript';
2
+ type Props = {
3
+ /**
4
+ The name of the system image (SF Symbol).
5
+ For example: 'photo', 'heart.fill', 'star.circle'
6
+ @ios
7
+ */
8
+ systemName?: SFSymbol;
9
+ /**
10
+ The size of the icon.
11
+ @ios
12
+ @default 100
13
+ */
14
+ iconSize?: number;
15
+ };
16
+ export default Props;
@@ -1,21 +1,3 @@
1
- import React from 'react';
2
- import colors, { sizes, sizesType } from './constants';
3
- export { sizes };
4
- export type Props = {
5
- /**
6
- The text to display in the gradient.
7
- Must be less than 3 characters.
8
- */
9
- text?: string;
10
- /**
11
- The color of the gradient.
12
- */
13
- color: keyof typeof colors;
14
- /**
15
- The size of the gradient.
16
- @default 'small'
17
- */
18
- type: sizesType;
19
- };
20
- declare const _default: React.MemoExoticComponent<({ text, color, type }: Props) => React.JSX.Element>;
21
- export default _default;
1
+ export { sizes } from './constants';
2
+ export { Props } from './components/Gradient/types';
3
+ export { default } from './components/Gradient';
@@ -1,33 +1,2 @@
1
- import React, { memo, useMemo } from 'react';
2
- import { StyleSheet, Text } from 'react-native';
3
- import { LinearGradient } from 'expo-linear-gradient';
4
- import colors, { sizes } from './constants';
5
- export { sizes };
6
- export default memo(({ text, color, type = 'small' }) => {
7
- const typeSizes = useMemo(() => sizes[type], [type]);
8
- const textComponent = useMemo(() => {
9
- const cantLetras = text?.length;
10
- if (!text || !cantLetras)
11
- return null;
12
- if (cantLetras > 3)
13
- throw new Error('Text must be less than 3 characters');
14
- return (<Text style={[styles.text, { fontSize: typeSizes.fontSize[cantLetras] }]} allowFontScaling={false}>
15
- {text}
16
- </Text>);
17
- }, [text, typeSizes]);
18
- return (<LinearGradient style={[styles.gradient, { height: typeSizes.diameter, borderRadius: typeSizes.diameter }]} colors={[colors[color].light, colors[color].dark]} start={{ x: 0, y: 0 }} end={{ x: 0, y: 1 }}>
19
- {textComponent}
20
- </LinearGradient>);
21
- });
22
- const styles = StyleSheet.create({
23
- gradient: {
24
- aspectRatio: 1, // width will automatically match height
25
- justifyContent: 'center',
26
- alignItems: 'center'
27
- },
28
- text: {
29
- color: 'white',
30
- fontWeight: 'bold',
31
- letterSpacing: -0.5,
32
- }
33
- });
1
+ export { sizes } from './constants';
2
+ export { default } from './components/Gradient';
@@ -13,9 +13,7 @@ type Props = {
13
13
  /**
14
14
  If it is given, displays a gradient.
15
15
  */
16
- gradientProps?: {
17
- text: GradientProps['text'];
18
- color: GradientProps['color'];
16
+ gradientProps?: Omit<GradientProps, 'type'> & {
19
17
  type: 'extraLarge' | 'extraExtraLarge';
20
18
  };
21
19
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-pytech",
3
- "version": "1.0.38",
3
+ "version": "1.0.41",
4
4
  "description": "Libreria de React Native Pytech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",