bhrott / react-native-masked-text

A pure javascript masked text and input text component for React-Native.
MIT License
1.61k stars 249 forks source link

Problem with removing characters in the middle of the mask #35

Closed Oxyaction closed 5 years ago

Oxyaction commented 7 years ago

v1.6.1 Having the following input

<TextInputMask
  type="custom"
  options={{ mask: '999 (99) 999 99 99' }}
/>

If I'll type 380934295576 the mask will display correct value like 380 (93) 429 55 76 But if I remove the 2 from the middle of the mask it will display 380 (93) 49, instead of 380 (93) 495 57 6.

I've made some research and figured that problem is in passing value to tinymask that is already masked. in this particular case the value 380 (93) 49 55 76 is passed to the mask method and since space after 9 char doesn't match to numeric wildcard all the following chars are getting trimmed.

Suggest passing normalized value to mask

bhrott commented 7 years ago

Hi!

Thanks for reporting =). I fix it at 1.6.2, but a little know issue still remain for white spaces (not affect your scenario).

valeryq commented 7 years ago

@benhurott Hi, it should be reopened. That's because not all cases were covered. Same example as @Oxyaction, but if I'll type 38093429557 (without last digit) the mask will display correct value 380 (93) 429 55 7 and if I remove the 2 from the middle of the mask it will display 380 (93) 495 57 (it's correct), but cursor jumping before 4 (but should be after 4). I think that's because last white space also deleting from the masked value.

Any idea to fix this?

bhrott commented 7 years ago

Hi,

Can you tell me the following informations?

valeryq commented 7 years ago

@benhurott React Native: 0.47.1 OS: iOS and Android react-native-masked-text: 1.6.2

bhrott commented 7 years ago

Nice,

I will reopen the issue.

IgorSorokopud commented 6 years ago

Hi, in v1.6.2 issue with the next scenario is reproduced:

fill in field "Phone number" +123 (45) 678 90. Move the cursor to number "5", and click delete button - cursor is jump to number "2", and deleted all numbers after "4"

megabayt commented 6 years ago

+1 waiting for fix

AndrewTotsky commented 6 years ago

+1 waiting for fix

IgorSorokopud commented 6 years ago

It helped me:

<TextInputMask type="cel-phone" options={{ dddMask: '+999 (99) 999 99 99' }} />

AndrewTotsky commented 6 years ago

me need mask +7 999 999-99-99

bhrott commented 6 years ago

Guys, I fix some issues about these scenarios in 1.9.0.

I'm still facing a little issue with cursor but for now, some of them are fixed.

StanislavVoronov commented 6 years ago

In my case type "credit-card" and mask "9999 9999 9999 9999". I'm starting to remove characters in the middle of each four block and something strange is happening, but making some changes, at least, it has right order.

Boolkast commented 5 years ago

Can u make phone mask? +7 999 999 9999 for example?

bhrott commented 5 years ago

Fixed at 1.11.1 after a thousand years.

Miilla commented 5 years ago

Hello, i have this problem on iOS only - cant remove separtor if cursor is not on the end of string. aa

React Native: 0.58.3 OS: iOS (12.1) react-native-masked-text: 1.12.3

TextInputMask values:

type={'custom'}
options={{
   mask: '999 999 999 999'
}}

@benhurott can you help me? :)

AlexanderKaplunsky commented 5 years ago

Hello, i have this problem on iOS only - cant remove separtor if cursor is not on the end of string. aa

React Native: 0.58.3 OS: iOS (12.1) react-native-masked-text: 1.12.3

TextInputMask values:

type={'custom'}
options={{
   mask: '999 999 999 999'
}}

@benhurott can you help me? :)

Any workaround for this issue..?

Findiglay commented 4 years ago

The issue seems to only apply to custom masks

coolirisroto commented 4 years ago

:( any updateS?