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 3487fc6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions components/ui/phone-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,20 @@ const PhoneInputSimple = ({ className, children, ...props }: PhoneInputSimplePro
);
PhoneInputSimple.displayName = "PhoneInputSimple";

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

const PhoneInput = ({ className, children, ...props }: PhoneInputProps) => (
const PhoneInput = React.forwardRef<
React.ElementRef<typeof RPNInput.default>,
RPNInput.Props<typeof RPNInput.default>
>(({ 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 3487fc6

Please sign in to comment.