diff --git a/react-native/app/components/input/text/component.tsx b/react-native/app/components/input/text/component.tsx
index 508e74c..675c8ed 100644
--- a/react-native/app/components/input/text/component.tsx
+++ b/react-native/app/components/input/text/component.tsx
@@ -1,22 +1,42 @@
-import React from 'react'
-import { LabelInput, WrapperInputText } from './styles';
+import React from 'react';
+import {LabelInput, WrapperInputText} from './styles';
type IInputText = {
- children?: object;
- placeholder: string;
- label: string;
- onChangeText?: any,
- value?: any
- autoCapitalize?: "none"
-}
-export const InputText = (props: IInputText)=>{
+ children?: object;
+ placeholder: string;
+ label: string;
+ onChangeText?: any;
+ value?: any;
+ autoCapitalize?: 'none';
+ autoCorrect?: false | true;
+ autoComplete?: 'off';
+ allowFontScaling?: true | false;
+};
+export const InputText = (props: IInputText) => {
+ const {
+ children,
+ placeholder,
+ label,
+ onChangeText,
+ value,
+ autoCapitalize,
+ autoCorrect,
+ autoComplete,
+ allowFontScaling,
+ } = props;
- const {children, placeholder, label, onChangeText, value, autoCapitalize} = props
-
- return (
- <>
- {props.label}
-
- >
- )
-}
\ No newline at end of file
+ return (
+ <>
+ {label}
+
+ >
+ );
+};
diff --git a/react-native/app/pages/store_portals/component.tsx b/react-native/app/pages/store_portals/component.tsx
index a4611d6..1c9e270 100644
--- a/react-native/app/pages/store_portals/component.tsx
+++ b/react-native/app/pages/store_portals/component.tsx
@@ -9,78 +9,104 @@ import { IStore } from './types';
import { initTranslation } from '../../translations/index';
import i18next from 'i18next';
-export const StorePortals = ({navigation, modalizeRef}:IStore)=>{
- initTranslation()
- const {portals, setPortals} = usePortal()
- const [name, setName] = React.useState('');
- const [url, setUrl] = React.useState('');
- const [emptyFields, setEmptyFields] = React.useState(false);
- const [nameAlreadyUsed, setNameAlreadyUsed] = React.useState(false);
+export const StorePortals = ({navigation, modalizeRef}: IStore) => {
+ initTranslation();
+ const {portals, setPortals} = usePortal();
+ const [name, setName] = React.useState('');
+ const [url, setUrl] = React.useState('');
+ const [emptyFields, setEmptyFields] = React.useState(false);
+ const [nameAlreadyUsed, setNameAlreadyUsed] = React.useState(false);
- async function newPortal(name:string, url:string){
- let portalsStorage;
- portalsStorage = await AsyncStorage.getItem('portal')
- portalsStorage = portalsStorage ? JSON.parse(portalsStorage) : null
- portalsStorage.push({name, url})
- AsyncStorage.setItem('portal', JSON.stringify(portalsStorage))
- setPortals(portalsStorage)
- modalizeRef?.current?.close();
- navigation.navigate(name)
+ async function newPortal(name: string, url: string) {
+ let portalsStorage;
+ portalsStorage = await AsyncStorage.getItem('portal');
+ portalsStorage = portalsStorage ? JSON.parse(portalsStorage) : null;
+ portalsStorage.push({name, url});
+ AsyncStorage.setItem('portal', JSON.stringify(portalsStorage));
+ setPortals(portalsStorage);
+ modalizeRef?.current?.close();
+ navigation.navigate(name);
+ }
+
+ async function onPress() {
+ //return false;
+ if (!name || !url) return setEmptyFields(true);
+ try {
+ let portalsFilter = portals.filter(
+ (portal: {name: string; url: string}) => {
+ if (portal.name != name) return false;
+ return portal;
+ },
+ );
+ if (portalsFilter.length >= 1) {
+ setNameAlreadyUsed(true);
+ return false;
+ }
+ await newPortal(name, url);
+ } catch (e) {
+ console.log('error', e);
+ await AsyncStorage.setItem('portal', JSON.stringify([]));
+ newPortal(name, url);
+ return null;
}
- async function onPress(){
- //return false;
- if(!name || !url) return setEmptyFields(true)
- try{
- let portalsFilter = portals.filter((portal: {name: string, url: string})=>{
- if(portal.name != name ) return false
- return portal
- })
- if(portalsFilter.length >= 1){
- setNameAlreadyUsed(true)
- return false;
- }
- await newPortal(name, url )
+ const textEmptyFields = () => (
+ <>
+ {emptyFields ? (
+
+ {i18next.t('mobileApp.portals.addPortalPopup.validation.emptyFilds')}
+
+ ) : null}
+ {nameAlreadyUsed ? (
+
+ {i18next.t(
+ 'mobileApp.portals.addPortalPopup.validation.portalNameAlreadyExists',
+ )}
+
+ ) : null}
+ >
+ );
- } catch(e){
- console.log('error', e)
- await AsyncStorage.setItem('portal', JSON.stringify([]))
- newPortal(name, url )
- return null
- }
- }
-
- const textEmptyFields = ()=>(
- <>
- {
- emptyFields ?
- {i18next.t("mobileApp.portals.addPortalPopup.validation.emptyFilds")}
- : null
- }
- {
- nameAlreadyUsed ?
- {i18next.t("mobileApp.portals.addPortalPopup.validation.portalNameAlreadyExists")}
- : null
- }
- >
- )
-
- return (
- <>
-
-
- {textEmptyFields()}
-
- setName(e)} placeholder={i18next.t("mobileApp.portals.fields.name.placeholder")} label={i18next.t("mobileApp.portals.fields.name.label")}/>
-
-
- setUrl(e)} placeholder={i18next.t("mobileApp.portals.fields.url.placeholder")} label={i18next.t("mobileApp.portals.fields.url.label")}/>
-
-
- {i18next.t("mobileApp.portals.addPortalPopup.confirm.button.label")}
-
-
-
- >
- )
-}
\ No newline at end of file
+ return (
+ <>
+
+
+ {textEmptyFields()}
+
+ setName(e)}
+ placeholder={i18next.t(
+ 'mobileApp.portals.fields.name.placeholder',
+ )}
+ label={i18next.t('mobileApp.portals.fields.name.label')}
+ />
+
+
+ setUrl(e)}
+ placeholder={i18next.t(
+ 'mobileApp.portals.fields.url.placeholder',
+ )}
+ label={i18next.t('mobileApp.portals.fields.url.label')}
+ />
+
+
+
+
+ {i18next.t(
+ 'mobileApp.portals.addPortalPopup.confirm.button.label',
+ )}
+
+
+
+
+
+ >
+ );
+}