Skip to content

Commit

Permalink
fix: wrapped phone input with forwardRef
Browse files Browse the repository at this point in the history
  • Loading branch information
omeralpi committed Feb 17, 2024
1 parent 39a9ad4 commit 73abb92
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions components/ui/phone-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,21 @@ const PhoneInputSimple = ({ className, children, ...props }: PhoneInputSimplePro
);
PhoneInputSimple.displayName = "PhoneInputSimple";

type PhoneInputProps = React.ComponentProps<typeof RPNInput.default>;

const PhoneInput = ({ className, children, ...props }: PhoneInputProps) => (
<RPNInput.default
className={cn("flex", className)}
placeholder={"Enter a phone number"}
flagComponent={FlagComponent}
countrySelectComponent={CountrySelect}
inputComponent={InputComponent}
{...props}
/>
type PhoneInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange"> &
RPNInput.Props<typeof RPNInput.default>;

const PhoneInput = React.forwardRef<React.ElementRef<typeof RPNInput.default>, PhoneInputProps>(
({ className, ...props }, ref) => (
<RPNInput.default
ref={ref}
className={cn("flex", className)}
placeholder={"Enter a phone number"}
flagComponent={FlagComponent}
countrySelectComponent={CountrySelect}
inputComponent={InputComponent}
{...props}
/>
),
);

PhoneInput.displayName = "PhoneInput";
Expand Down

0 comments on commit 73abb92

Please sign in to comment.