diff --git a/src/Input.tsx b/src/Input.tsx index ac8d23c..5314129 100644 --- a/src/Input.tsx +++ b/src/Input.tsx @@ -7,7 +7,7 @@ import { } from 'formik'; import { FormField, - Input as _Input, + Input as SInput, InputOnChangeData, InputProps as _InputProps, Label, @@ -37,7 +37,7 @@ export const Input = ( inputLabel, ...restProps }: InputProps, - ref: Ref<_Input>, + ref: Ref, ) => { const fieldLabelId = (id && label && `${id}-field-label`) || undefined; const inputLabelId = (id && inputLabel && `${id}-input-label`) || undefined; @@ -61,12 +61,12 @@ export const Input = ( ); }; - const errorLabelBefore = (meta: FieldMetaProps<_Input>) => + const errorLabelBefore = (meta: FieldMetaProps) => (getErrorConfig(meta, errorPrompt)?.pointing === 'below' || getErrorConfig(meta, errorPrompt)?.pointing === 'right') && errorLabel(meta); - const errorLabelAfter = (meta: FieldMetaProps<_Input>) => + const errorLabelAfter = (meta: FieldMetaProps) => (getErrorConfig(meta, errorPrompt)?.pointing === 'above' || getErrorConfig(meta, errorPrompt)?.pointing === 'left') && errorLabel(meta); @@ -77,7 +77,7 @@ export const Input = ( {fieldLabel} {errorLabelBefore(meta)} - <_Input + ( if (meta.error && meta.touched && errorPrompt) { if (errorPrompt === true) { return { content: meta.error, ...defaultErrorConfig }; - ; } else { - return { content: meta.error, ...errorPrompt ; }; + return { content: meta.error, ...errorPrompt }; } } else { - return nu; - ll; + return null; } }