akinncar / react-native-mask-text

🎭 A React Native and Expo library to mask text and inputs
MIT License
417 stars 40 forks source link

mask=undefined doesn't allow any input #55

Closed SrBrahma closed 2 years ago

SrBrahma commented 2 years ago

Steps to reproduce

  1. Have a MaskedTextInput without mask being defined
  2. Type something and text gets erased after being shown

Expected behaviour

If mask is undefined, the mask/unmask shouldn't be used. If mask is optional, it doesn't make too much sense that it is required to be used.

Actual behaviour

It erases any entered input.

Why I want it? So I can use the MaskedTextInput in the place of TextInput in my new TextInput component, and it would only mask and unmask if mask prop is defined.

I already solved it in a local code, just changed 4 lines in the component, by basically just doing pattern !== undefined ? unMask(value, type) : value; etc. I can PR it if wanted.

It may feel a little counter intuitive to use a MaskedTextInput and don't use a mask, but it just simplifies custom TextInputs.

react-native-mask-text

Version: 0.7.0

snndmnsz commented 2 years ago

i have the same problem, i want to disable mask in some cases but i cant. I tried null , undefined even empty string but none of them worked.

github-actions[bot] commented 2 years ago

:tada: This issue has been resolved in version 0.13.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

SrBrahma commented 2 years ago

Thanks, @akinncar!