CaioQuirinoMedeiros / react-native-mask-input

🎭:iphone: A simple and effective Text Input with mask for ReactNative on iOS and Android. Includes obfuscation characters feature.
https://www.npmjs.com/package/react-native-mask-input
MIT License
309 stars 31 forks source link

Weird `selection` behavior #11

Closed nandorojo closed 2 years ago

nandorojo commented 2 years ago

As I'm typing, it seems that the selection prop is changing randomly. Notice that, as I try to add numbers to the start of the TextInput, the selection suddenly jumps to the end.

https://user-images.githubusercontent.com/13172299/142509772-843872a7-7c60-4a9d-8166-c5079b06b9bc.mp4

Code: https://snack.expo.dev/@nandorojo/humiliated-pretzel

Try typing a few numbers, then move the cursor to the start of the input, and type a few more.

CaioQuirinoMedeiros commented 2 years ago

Typing with the cursor in any position other than the end is always a struggle in a masked text input (talking about ReactNative). I'll take a look at it as soon as I can, but I'll add that I don't have a good feeling about having it fixed.

Btw, if your need is a currency input you may give a chance to ReactNativeCurrencyInput

nandorojo commented 2 years ago

Oh cool I’ll try that thanks!

nandorojo commented 2 years ago

Looks like the cursor issue still exists on that lib, but the precision:0 does work!

nandorojo commented 2 years ago

Thanks for the quick help btw @CaioQuirinoMedeiros!