This plugin extends the {N} TextView to allow for input masking.
iOS 7+
Android API 17+
Plugin does not support the use of the keyboardType property from TextView.
Plugin will attempt to determine the mask type and display the appropriate keyboardType automatically.
Run tns plugin add nativescript-maskedinput
To use MaskedInput you need to include it in your XML.
Add the following to your page directive.
xmlns:mi="nativescript-maskedinput"
Use MaskedInput by adding the following XML.
<mi:MaskedInput mask="1-999-999-9999? x999" hint="1-555-555-5555" placeholder="#" />
Get or Set the mask used for input
- 9 is the same as RegEx [0-9]
- a is the same as RegEx [A-Za-z]
- * is the same as RegEx [A-Za-z0-9]
- ? specifies that anything after the ? is optional.
-
- |
- /
- \
- .
- $
-
- ( )
- [ ]
- { }
Returns true or false if the input text matches the mask.
Use the FormattedText
property or the text
property to validate the input.
Gets or Sets the placeholder.
Default: _
Gets only the text that matches the RegEx pattern from the mask.
You cannot validate the RawText property. It will fail.
Gets the Full text including any seperators as specified in the mask.
Gets the regex that was created from the mask so that you can perform your own validation.