# nativescript-maskedinput

> A {N} masked input plugin for iOS and Android

Latest version **0.0.3** (published 2016-07-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install nativescript-maskedinput
pnpm add nativescript-maskedinput
yarn add nativescript-maskedinput
bun add nativescript-maskedinput
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2016-07-07 |
| First published | 2016-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | bthurlow |
| Maintainers | bthurlow |
| Keywords | NativeScript, masked, input, textbox, edittext |

## Links

- npm: https://www.npmjs.com/package/nativescript-maskedinput
- Repository: https://github.com/bthurlow/nativescript-maskedinput
- Issues: https://github.com/bthurlow/nativescript-maskedinput/issues
- npm.io page: https://npm.io/package/nativescript-maskedinput

## Recent versions

- 0.0.3 (latest) — 2016-07-07
- 0.0.2 — 2016-04-28
- 0.0.1 — 2016-04-25

## README

<!--
@Author: Brian Thurlow <bthurlow>
@Date:   04/20/2016 10:42:09 AM
@Last modified by:   Brian Thurlow
@Last modified time: 04/20/2016 11:14:11 AM
-->

# A {N} Masked Input Plugin

[![License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat)](http://choosealicense.com/licenses/mit/) [![npm](https://img.shields.io/npm/v/nativescript-maskedinput.svg)](https://www.npmjs.com/package/nativescript-maskedinput) [![npm](https://img.shields.io/npm/dt/nativescript-maskedinput.svg?label=npm%20downloads)](https://www.npmjs.com/package/nativescript-maskedinput) [![GitHub release](https://img.shields.io/github/release/bthurlow/nativescript-maskedinput.svg)](https://github.com/bthurlow/nativescript-maskedinput)

This plugin extends the {N} TextView to allow for input masking.

## Notes

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.

## Installation

Run `tns plugin add nativescript-maskedinput`

### Usage

To use MaskedInput you need to include it in your XML.

Add the following to your page directive.
```xmlns
xmlns:mi="nativescript-maskedinput"
```

Use MaskedInput by adding the following XML.
```XML
<mi:MaskedInput mask="1-999-999-9999? x999" hint="1-555-555-5555" placeholder="#" />
```

### Properties

#### mask [string]

Get or Set the mask used for input

#### mask options

- 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.

###### Supported Seperators
* -
* |
* /
* \
* .
* $
* +
* ( )
* [  ]
* { }

#### valid [boolean]

Returns true or false if the input text matches the mask.

Use the ```FormattedText``` property or the ```text``` property to validate the input.

#### placeholder [string]

Gets or Sets the placeholder.

Default: _

#### RawText [string]

Gets only the text that matches the RegEx pattern from the mask.

You cannot validate the RawText property.  It will fail.

#### FormattedText [string]

Gets the Full text including any seperators as specified in the mask.

#### regEx [string]

Gets the regex that was created from the mask so that you can perform your own validation.

---
_Source: https://npm.io/package/nativescript-maskedinput · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
