Skip to content

Commit 136f11e

Browse files
authored
otp fix (#158)
1 parent 35c2815 commit 136f11e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

components/form/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,11 @@ function Switch<T extends FieldValues>({
315315
Form.Switch = Switch;
316316

317317
interface OTPProps<T extends FieldValues>
318-
extends Omit<BaseInputProps<T>, "type"> {
318+
extends Omit<BaseInputProps<T>, "type" | "onChange" | "value">,
319+
Omit<
320+
React.ComponentProps<typeof InputOTP>,
321+
"value" | "onChange" | "maxLength" | "name" | "render"
322+
> {
319323
maxLength?: number;
320324
children?: React.ReactNode;
321325
slotClassName?: string;
@@ -343,10 +347,10 @@ function OTP<T extends FieldValues>({
343347
{label && <FormLabel>{label}</FormLabel>}
344348
<FormControl>
345349
<InputOTP
350+
{...rest}
346351
maxLength={maxLength}
347352
value={String(field.value || "")}
348353
onChange={(value: string) => field.onChange(value)}
349-
{...(rest as any)}
350354
>
351355
{children || (
352356
<InputOTPGroup className={groupClassName}>

0 commit comments

Comments
 (0)