import { FieldProps } from '@/core/types'; import { useTailwind } from '@/hooks'; import { View } from 'react-native'; import { Style } from 'twrnc/dist/esm/types'; import MultilineTextInput, { MultilineTextInputProps } from '../input/multiline/MultilineTextInput'; import IconTextInput, { IconTextInputProps } from '../input/singleline/IconTextInput'; import Text from '../text/Text'; type MixinTextInputProps = T extends true ? MultilineTextInputProps : IconTextInputProps; type TextInputProps = MixinTextInputProps & { multiline?: T; wrapperStyle?: Style; }; export default function TextInput({ label, name, placeholder, multiline, containerStyle, wrapperStyle, _fieldProps, ...props }: FieldProps>) { const tw = useTailwind(); const { field, fieldState } = _fieldProps!; const TextInputComponent = multiline ? MultilineTextInput : IconTextInput; return ( {!!label && {label}} {!!fieldState.error?.message && ( {fieldState.error.message} )} ); }