React Native Phone Input

Does anyone know of any libraries for text inputs that use phone formatting masks? All of the ones that I've found seem to have been abandoned years ago. I'm surprised that something so integral to auth isn't highly sought after. You could filter out any non-numerical characters using an onChangeText handler, setting state manually and assigning it to the TextField's value prop, but this leads to a jumpy UI where the unwanted character is shown briefly before being removed. I'm assuming this is happening because the state being set on the JS layer tries to override the native text input component AFTER the native layer has already set its own internal state.
4 Replies
The Zach
The Zach4w ago
GitHub
GitHub - akinncar/react-native-mask-text: 🎭 A React Native and Expo...
🎭 A React Native and Expo library to mask text and inputs - akinncar/react-native-mask-text
The Zach
The Zach4w ago
did you try it? I've used this library ton of times for my react native expo development. It's enough for me. Also the @akinncar who is creator is so helpful guy.
Jimmy Page
Jimmy PageOP4w ago
That library has the jumpy UI problem too, unfortunately. Probably going to end up having to make a Native Module
The Zach
The Zach3w ago
what problem are you cause now?

Did you find this page helpful?