Skip to content

MaskedTextInput

Component | Source Code

extends Omit<TextInputProps, “onChangeText”>

Props Inheritance Hierarchy: Omit<TextInputProps, “onChangeText”>

Receives user input in the form of text. Allows masking the input to limit accepted characters.

You can choose whether you control this component, but if you don’t control it, the component will control the underlying input for you. This allows a provided mask to still apply to any input.

Mask to apply to the input. The masking is applied using maskText.

const onlyNumbersMask = /\d/;

Handler for when the user attempts to change the input.