diff --git a/src/components/FormInput.tsx b/src/components/FormInput.tsx index be81110..d40eca5 100644 --- a/src/components/FormInput.tsx +++ b/src/components/FormInput.tsx @@ -1,7 +1,9 @@ -import { Input, Text, WarningOutlineIcon, FormControl, IInputProps } from 'native-base'; import React from 'react'; import { Controller, UseControllerProps } from 'react-hook-form'; -import { ReturnKeyTypeOptions } from 'react-native'; +import { ReturnKeyTypeOptions, Text, StyleSheet } from 'react-native'; +import { TextField, TextFieldProps } from 'react-native-ui-lib'; + +import theme from 'src/theme'; type FormInputProps = { // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -12,7 +14,7 @@ type FormInputProps = { label: string; rules?: UseControllerProps['rules']; returnKeyType?: ReturnKeyTypeOptions; -} & IInputProps; +} & TextFieldProps; const FormInput = ({ errors, @@ -31,26 +33,41 @@ const FormInput = ({ control={control} rules={rules} render={({ field: { onChange, onBlur, value, ref } }) => ( - - {label} - + - {fieldError && ( - }> - {fieldError.message?.toString()} - - )} - + {fieldError && {fieldError.message?.toString()}} + )} name={name} defaultValue="" /> ); }; + +const styles = StyleSheet.create({ + field: { + borderColor: theme.colors.gray1, + borderWidth: 1, + borderRadius: 4, + padding: 4, + marginVertical: 4, + }, + fieldWithError: { + borderColor: theme.colors.danger, + }, + errorMessage: { + color: theme.colors.danger, + marginBottom: 4, + }, +}); + export default FormInput; diff --git a/src/modules/login/Login.tsx b/src/modules/login/Login.tsx index ca3fcfe..530c60c 100644 --- a/src/modules/login/Login.tsx +++ b/src/modules/login/Login.tsx @@ -19,9 +19,9 @@ const Login = () => {