Skip to content

Commit

Permalink
fix: #71 입력폼 공통 컴포넌트 내 register 함수의 2번째 인자 객체 내부의 프로퍼티가 disabled 면, i…
Browse files Browse the repository at this point in the history
…nput 태그 내에 disabled 를 직접 주입하도록 로직 변경
  • Loading branch information
kimsuyeon0916 committed Apr 11, 2024
1 parent 0ffb937 commit 775a2d8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ const Input = <T extends FieldValues>({
const inputErrorMessage = formState?.errors[name]?.message as string;
const inputValue = watch?.(name as Path<T>);

const { ref, ...rest } = register(name as Path<T>, validation);
const { ref, ...rest } = register(name as Path<T>, validation?.disabled ? undefined : validation);

return (
<S.InputLabel $width={width}>
{label && <h6>{label}</h6>}
<S.InputContainer>
<S.Input
disabled={validation?.disabled}
{...rest}
{...props}
{...icon}
Expand Down

0 comments on commit 775a2d8

Please # to comment.