native-pytech 1.0.9 → 1.0.12

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.
@@ -2,6 +2,7 @@ import { StyleProp } from 'react-native';
2
2
  import React from 'react';
3
3
  export declare const addProps: (element: React.ReactElement | null, additionalStyles?: StyleProp<any>, extraProps?: Record<string, any>) => React.ReactElement | null;
4
4
  export declare const numberFormat: (value: number) => string;
5
+ export declare const numberFormatInverted: (value: string) => number;
5
6
  export declare function applyOpacity(color: string, opacity: number): string;
6
7
  export declare function adjustLightness(color: string, percentage: number): string;
7
8
  export declare const _getDeviceTier: () => "low" | "medium" | "high";
@@ -18,6 +18,18 @@ export const numberFormat = (value) => {
18
18
  const abs = formatter.format(Math.abs(value));
19
19
  return value < 0 ? `(${abs})` : abs;
20
20
  };
21
+ export const numberFormatInverted = (value) => {
22
+ const trimmed = value.trim();
23
+ const isNegative = /^\(.*\)$/.test(trimmed);
24
+ const normalized = trimmed
25
+ .replace(/[()]/g, '')
26
+ .replace(/\./g, '')
27
+ .replace(',', '.');
28
+ const parsed = Number.parseFloat(normalized);
29
+ if (Number.isNaN(parsed))
30
+ return 0;
31
+ return isNegative ? -parsed : parsed;
32
+ };
21
33
  export function applyOpacity(color, opacity) {
22
34
  try {
23
35
  const [r, g, b] = parseToRgba(color); // ignoro alpha original
@@ -5,7 +5,6 @@ import Screen from '../Screen';
5
5
  import { handleSubmitLogInPerfil } from './utils';
6
6
  export default memo(({ routeOnSuccess, onSuccess }) => {
7
7
  const { mail, first_name, gradient_text, color } = useLocalSearchParams();
8
- console.log('gradient_text', gradient_text);
9
8
  const router = useRouter();
10
9
  const handleSubmit = async ({ value }) => {
11
10
  const { succeded, message } = await handleSubmitLogInPerfil({ mail, password: value });
@@ -5,10 +5,10 @@ export const handleSubmitLogIn = async ({ username, router }) => {
5
5
  name: 'login',
6
6
  args: { p_identifier: identifier }
7
7
  });
8
- if (!data)
8
+ if (!data || data.length === 0)
9
9
  return { succeded: false, message: 'Revisa la información de la cuenta que ingresaste y vuelve a intentarlo.' };
10
10
  // Success
11
- router.push({ pathname: '/login/inicio/perfil', params: data });
11
+ router.push({ pathname: '/login/inicio/perfil', params: data[0] });
12
12
  return { succeded: true, message: '' };
13
13
  };
14
14
  export const handleSubmitLogInPerfil = async ({ mail, password }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-pytech",
3
- "version": "1.0.9",
3
+ "version": "1.0.12",
4
4
  "description": "Libreria de React Native Pytech",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",