-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(phone-input): new phone input component #2694
base: main
Are you sure you want to change the base?
Conversation
@omeralpi is attempting to deploy a commit to the shadcn-pro Team on Vercel. A member of the Team first needs to authorize it. |
a065890
to
b9a503d
Compare
Default value in 'react-phone-number-input' updated to 'null' for 'react-hook-form' consistency.
…ring refactor: removed unnecessary PhoneInputValue type, as it is self-typed.
{options.map((option) => ( | ||
<CommandItem | ||
className="gap-2" | ||
key={option.value} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something is not right with the values as I get a warning about duplicate keys:
Warning: Each child in a list should have a unique "key" prop. See https://reactjs.org/link/warning-keys for more information.
at eval (webpack-internal:///(ssr)/./components/ui/command.tsx:128:84)
at CountrySelect (webpack-internal:///(ssr)/./components/ui/custom/phone-input.tsx:76:26)
at div
at PhoneNumberInput_ (webpack-internal:///(ssr)/./node_modules/react-phone-number-input/modules/PhoneInputWithCountry.js:243:9)
at eval (webpack-internal:///(ssr)/./node_modules/react-phone-number-input/modules/PhoneInputWithCountryDefault.js:62:34)
at div
at eval (webpack-internal:///(ssr)/./components/ui/custom/phone-input.tsx:27:83)
at eval (webpack-internal:///(ssr)/./node_modules/@radix-ui/react-slot/dist/index.mjs:42:23)
at eval (webpack-internal:///(ssr)/./node_modules/@radix-ui/react-slot/dist/index.mjs:16:23)
at eval (webpack-internal:///(ssr)/./components/ui/form.tsx:100:87)
at div
at eval (webpack-internal:///(ssr)/./components/ui/form.tsx:65:84)
at Controller (webpack-internal:///(ssr)/./node_modules/react-hook-form/dist/index.esm.mjs:511:39)
at FormField (webpack-internal:///(ssr)/./components/ui/form.tsx:28:25)
at div
at div
at eval (webpack-internal:///(ssr)/./components/ui/card.tsx:58:84)
at div
at eval (webpack-internal:///(ssr)/./components/ui/card.tsx:18:77)
at div
...
I fixed it for now by changing the key to key={option.label + option.value}
, although I don't like that method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And then as the solution; key={option.value || "ZZ"}
.
"ZZ" means "International" (see).
Thank you for the review. 😊
@omeralpi thanks for this component! I wonder if the best idea is to use the |
@omeralpi I will be building this same component with the |
Thanks for the review! I can say that it's not as simple as that. Because; We'll need to import packages like InputFormat, etc. Additionally, both libphonenumber-js and react-phone-input-number packages are created by the same person. |
@omeralpi Last night I uploaded this app with the repo |
Hello guys, is the development of this component still active? |
Hello everyone,
I noticed many users struggling with phone input validation in forms (#903).
Inspired by this, I'm simplifying the process by adding a user-friendly phone input feature. 🚀
Features
react-phone-number-input
package.Here is a complete video of the different use cases:
Screen.Recording.2024-02-06.at.20.45.26.mov