From ae4eef5e4ffeef798b2d6077f84dd7b389c2432e Mon Sep 17 00:00:00 2001 From: Brokyeom Date: Mon, 18 Nov 2024 17:26:36 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20TextField=20value=20optional=EB=A1=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ui/Input/TextField.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ui/Input/TextField.tsx b/packages/ui/Input/TextField.tsx index 959a808..683079e 100644 --- a/packages/ui/Input/TextField.tsx +++ b/packages/ui/Input/TextField.tsx @@ -10,7 +10,7 @@ interface TextFieldProps extends Omit, descriptionText?: string; required?: boolean; errorMessage?: string; - value: T; + value?: T; // isError -> validationFn 순서로 적용 isError?: boolean; validationFn?: (input: T) => boolean; @@ -34,7 +34,7 @@ function TextField(props: TextFieldProps) { const hasError = () => { if (inputProps.disabled || inputProps.readOnly) return false; if (isError !== undefined) return isError; - if (validationFn && !validationFn(value)) return true; + if (validationFn && value && !validationFn(value)) return true; return false; };