Theo's Typesafe CultTTC
Theo's Typesafe Cult12mo ago
6 replies
Jimmy Page

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.
Was this page helpful?