sanniassin / react-input-mask

Input masking component for React. Made with attention to UX.
MIT License
2.22k stars 258 forks source link

Array of RegExp masks not working? #197

Closed reintroducing closed 4 years ago

reintroducing commented 4 years ago

I'm trying a very simple RegExp set of masks and its not working, I can type anything in the field:

<InputMask
    mask={[/^([0-2])/, /([0-9])/, ':', /[0-5]/, /[0-9]/]}
/>

Any idea why this would be happening? It seems like this should be correct according to the docs. Thanks.

lexkomlev commented 4 years ago

Same problem. I tried to use cyrillic symbols in mask, and it's not working too

<InputMask
    mask={[/[а-я]/i, /а-я/i, ' ', /[0-9]/, /0-9/]}
/>
ghost commented 4 years ago

What version of react-input-mask you are using? It works with 3.0.0-alpha.0

reintroducing commented 4 years ago

@demkovych Ah, we are using 2.0.4. Is this a 3.x+ feature? I didn't realize 3.x was out, I was just pulling in what npm had which is still 2.0.4.

reintroducing commented 4 years ago

Well, I realized I was using 2.x and the master README is for 3.x. 2.x only uses strings for masks. @sanniassin should probably update the README in master saying that these docs are for 3.x since npm install still installs 2.x, which makes this quite confusing.

reintroducing commented 4 years ago

Disregard my comment above, it actually is mentioned in the readme and i just didn't read it. I guess what I was trying to say is that master should match what npm install will give a user to avoid confusion :)

vanikalai commented 3 years ago

I have update the version to 3.00-alpha.0 but still its not working Actually I am facing the issue like onchange is not with Input MasK