Skip to content
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

Dynamic mask #67

Open
riessnico opened this issue Oct 30, 2023 · 1 comment
Open

Dynamic mask #67

riessnico opened this issue Oct 30, 2023 · 1 comment

Comments

@riessnico
Copy link

Hi, congratulations on the amazing library first!

Is there a way to apply dynamic masking? I could not make it work with the examples provided on the doc. I am using react-hook-form as the form manager. The input is abstracted away using the withHookFormMask under the hood and I tried to experiment with the options from the third argument of this function with no success, though.

The same input could be either an email or a telephone number and I wanted to show the mask if the input is a telephone.

Thanks again!

@eduardoborges
Copy link
Owner

Hey @riessnico im sorry about the response time.

In docs i describe how dynamic masks works. i know, i need to describe better :/

In your case, this mask resolves.

<input type="text" ref={withMask(["(99) 9999 9999", "(99) 9 9999 9999", "*{1,20}[.*{1,20}][.*{1,20}][.*{1,20}]@*{1,20}[.*{2,6}][.*{1,2}]"])} />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants