Masking react-native TextInput
I am trying to figure out how to mask TextInput for a react-native app. I am completely new react-native, and I would prefer to not have to code a component for each iOS, Android and potentially Windows. I see a bunch of existing modules for jQuery and regular React. Did not find one for react-native.
How does one go about addressing something like this? Do I attach a listener to the text input field, and rewrite the representation whenever the value of my field changes?
Please advise.
Ended-up hooking onChangeText and just using a roll-my-own function. Instead of onChangeText, we could also hook event from onChange. The arguments are different text vs event.
You can use secureTextEntry
for password kind of masking:
<TextInput secureTextEntry={true} />
https://facebook.github.io/react-native/docs/textinput.html#securetextentry
Comments
Post a Comment