From e6bf808df9b36a36d15b8770dfdeeb8876399323 Mon Sep 17 00:00:00 2001 From: Johnny Tsoi Date: Thu, 12 Nov 2020 16:15:23 +0800 Subject: [PATCH] fix(Input): CI Building Warning --- src/Input.tsx | 10 +++++----- src/utils.ts | 6 ++---- 2 files changed, 7 insertions(+), 9 deletions(-) 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; } }