native-pytech 1.0.88 → 1.0.90

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,2 +1 @@
1
1
  export { default } from '../libs/colorPage';
2
- export * from '../libs/colorPage';
@@ -1,2 +1 @@
1
1
  export { default } from '../libs/colorPage';
2
- export * from '../libs/colorPage';
@@ -1,3 +1 @@
1
1
  export { default } from './src/Page';
2
- export { default as ColorPageProps } from './src/Page/types';
3
- export { default as renderItemProps } from './src/Item/types';
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import type Props from './types';
3
- declare const _default: React.MemoExoticComponent<({ colorRows, renderItem, ...pageProps }: Props) => React.JSX.Element>;
2
+ import Props from './types';
3
+ declare const _default: React.MemoExoticComponent<({ colorRows, ...pageProps }: Props) => React.JSX.Element>;
4
4
  export default _default;
@@ -1,12 +1,12 @@
1
+ import React, { memo } from 'react';
1
2
  import { Host, Column, Row } from '@expo/ui/jetpack-compose';
2
- import React, { Fragment, memo } from 'react';
3
- export default memo(({ colorRows, renderItem, ...pageProps }) => {
3
+ import { fillMaxWidth } from '@expo/ui/jetpack-compose/modifiers';
4
+ import Item from '../Item';
5
+ export default memo(({ colorRows, ...pageProps }) => {
4
6
  return (<Host style={{ flex: 1 }}>
5
- <Column verticalArrangement={{ spacedBy: 16 }}>
6
- {colorRows.map((row, index) => (<Row key={index} verticalArrangement="spaceEvenly">
7
- {row.map((color, indexColor) => renderItem == null ? null : (<Fragment key={indexColor}>
8
- {React.createElement(renderItem, { color, size: 55, ...pageProps })}
9
- </Fragment>))}
7
+ <Column verticalArrangement={{ spacedBy: 2 }}>
8
+ {colorRows.map((row, index) => (<Row key={index} horizontalArrangement="spaceEvenly" verticalArrangement="center" modifiers={[fillMaxWidth()]}>
9
+ {row.map((color, indexColor) => (<Item key={color} color={color} size={55} {...pageProps}/>))}
10
10
  </Row>))}
11
11
  </Column>
12
12
  </Host>);
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import Props from './types';
3
+ declare const _default: React.MemoExoticComponent<({ color, size, selectedColor, onSelectColor, renderGradient, }: Props) => React.JSX.Element>;
4
+ export default _default;
@@ -0,0 +1,40 @@
1
+ import React, { memo } from 'react';
2
+ import { Shape, Surface, Box } from '@expo/ui/jetpack-compose';
3
+ import { background, clip, Shapes, clickable, paddingAll, alpha, size as sizeModifier } from '@expo/ui/jetpack-compose/modifiers';
4
+ import { colors } from '../../../../libs/components/Gradient';
5
+ export default memo(({ color, size, selectedColor, onSelectColor, renderGradient, }) => {
6
+ if (!renderGradient)
7
+ return null;
8
+ const isSelected = color === selectedColor;
9
+ const innerBorderWidth = 2;
10
+ const outerBorderWidth = 3;
11
+ return (<Surface color='#00000000' shape={Shape.RoundedCorner({
12
+ cornerRadii: {
13
+ topStart: size,
14
+ topEnd: size,
15
+ bottomStart: size,
16
+ bottomEnd: size,
17
+ },
18
+ })} border={{ width: outerBorderWidth, color: isSelected ? colors[color].middle : '#00000000' }} modifiers={[clip(Shapes.Circle)]}>
19
+ <Box contentAlignment="center" modifiers={[
20
+ background('#00000000'),
21
+ paddingAll(outerBorderWidth * 2),
22
+ clip(Shapes.Circle),
23
+ clickable(() => onSelectColor?.(color))
24
+ ]}>
25
+
26
+ <Box contentAlignment="center" modifiers={[sizeModifier(size, size)]}>
27
+
28
+ {!isSelected &&
29
+ <Box contentAlignment="center" modifiers={[sizeModifier(size, size)]}>
30
+ {React.createElement(renderGradient, { color, size })}
31
+ <Box modifiers={[sizeModifier(size, size), alpha(0.25), background('#FFFFFF')]}/>
32
+ </Box>}
33
+
34
+ {React.createElement(renderGradient, { color, size: size - (!isSelected ? innerBorderWidth * 2 : 0) })}
35
+
36
+ </Box>
37
+
38
+ </Box>
39
+ </Surface>);
40
+ });
@@ -1,6 +1,6 @@
1
1
  import type { ColorsType } from '../../../../libs/components/Gradient';
2
- import { BaseProps } from '../Page/types';
3
- type Props = BaseProps & {
2
+ import PropsPage from '../Page/types';
3
+ type Props = PropsPage & {
4
4
  /**
5
5
  Color to display.
6
6
  */
@@ -1,6 +1,5 @@
1
1
  import type { ColorsType } from '../../../../libs/components/Gradient';
2
- import type itemProps from '../Item/types';
3
- export type BaseProps = {
2
+ type Props = {
4
3
  /**
5
4
  Title of the date picker.
6
5
  @default 'default'
@@ -10,11 +9,19 @@ export type BaseProps = {
10
9
  Function to be called when the user selects a color.
11
10
  */
12
11
  onSelectColor?: (color: ColorsType) => void;
13
- };
14
- type Props = BaseProps & {
15
12
  /**
16
13
  Function to render the item.
17
14
  */
18
- renderItem?: (props: itemProps) => React.ReactNode;
15
+ renderGradient?: (props: renderGradientProps) => React.ReactNode;
16
+ };
17
+ type renderGradientProps = {
18
+ /**
19
+ Color to display.
20
+ */
21
+ color: ColorsType;
22
+ /**
23
+ Size of the item.
24
+ */
25
+ size: number;
19
26
  };
20
27
  export default Props;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-pytech",
3
- "version": "1.0.88",
3
+ "version": "1.0.90",
4
4
  "description": "Libreria de React Native Pytech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",