akinncar/react-native-mask-text

mask=undefined doesn't allow any input

ftzi opened this issue ยท 3 comments

ftzi commented

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

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.

๐ŸŽ‰ This issue has been resolved in version 0.13.0 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€

Thanks, @akinncar!