omeralpi / shadcn-phone-input

Customizable phone input component with proper validation for any country. Built on top of shadcn.
https://shadcn-phone-input.vercel.app
MIT License
422 stars 28 forks source link

How to make this field optional ? #8

Closed omunite215 closed 5 months ago

omunite215 commented 5 months ago

Can you suggest any way how to make this field optional ? phone: z.string().refine(isValidPhoneNumber, { message: "Invalid phone number" }).optional()

Will this change work?

By the way, Thanks for building this component and my humble appreciation for your efforts in building it

omeralpi commented 5 months ago

@omunite215 Can you test the pull request I just published? The optional feature is currently working well.

omunite215 commented 5 months ago

@omunite215 Can you test the pull request I just published? The optional feature is currently working well.

Unfortunately, it didn't worked. But I have fixed my changing zod schema. I have also opened a pull request making some imrpovements in readMe.md file so that anybody can choose between REQUIRED fields and OPTIONAL fields.

omunite215 commented 5 months ago

This issue has been fixed.