import { IonInput, IonLabel } from '@ionic/react'; import styles from './style.module.scss'; interface CustomFieldProps { field: { id: string; label: string; required: boolean; input: { props: { type: | 'date' | 'email' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'url' | 'time' | 'week' | 'month' | 'datetime-local'; placeholder: string; // }; state: { value: string; reset: (newValue: any) => void; onIonChange: (e: any) => Promise; onKeyUp: (e: any) => Promise; }; }; }; errors: any; } function CustomField({ field, errors }: CustomFieldProps): React.JSX.Element { const error = errors && errors.filter((e: { id: string }) => e.id === field.id)[0]; const errorMessage = error && errors.filter((e: { id: string }) => e.id === field.id)[0].message; return ( <>
{field.label} {error &&

{errorMessage}

}
); } export { CustomField };