All Projects → PeterStaev → Nativescript Masked Text Field

PeterStaev / Nativescript Masked Text Field

Licence: apache-2.0
#️⃣ A NativeScript Masked Text Field widget

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Nativescript Masked Text Field

Nativescript Drop Down
A NativeScript DropDown widget.
Stars: ✭ 107 (+345.83%)
Mutual labels:  nativescript, widget
Masked Edittext
Android library contain custom realisation of EditText component for masking and formatting input text
Stars: ✭ 592 (+2366.67%)
Mutual labels:  widget, mask
yii2-number
A number format mask control and input for Yii2 Framework
Stars: ✭ 22 (-8.33%)
Mutual labels:  widget, mask
Nativescript Image Swipe
A NativeScript widget to easily 👆 and 🔍 through a list of images
Stars: ✭ 35 (+45.83%)
Mutual labels:  nativescript, widget
Maskara
A simple way to format text fields without getting affected by input filters
Stars: ✭ 515 (+2045.83%)
Mutual labels:  widget, mask
Stepper Touch
Stepper Touch for Android based on MaterialUp submission
Stars: ✭ 621 (+2487.5%)
Mutual labels:  widget
Circular Music Progressbar
Beautiful Circular Progress Bar with album art for android
Stars: ✭ 813 (+3287.5%)
Mutual labels:  widget
Emojix
Implementation of iOS style emoji on android.
Stars: ✭ 585 (+2337.5%)
Mutual labels:  widget
Log Progress
https://habr.com/ru/post/276725/
Stars: ✭ 556 (+2216.67%)
Mutual labels:  widget
Jquery Datetextentry
jQuery plugin providing a widget for date entry (not a date picker)
Stars: ✭ 19 (-20.83%)
Mutual labels:  widget
Yii2 Fotorama Widget
Fotorama image gallery widget for yii2
Stars: ✭ 18 (-25%)
Mutual labels:  widget
Ngx Mask
Angular Plugin to make masks on form fields and html elements.
Stars: ✭ 772 (+3116.67%)
Mutual labels:  mask
Dlangui
Cross Platform GUI for D programming language
Stars: ✭ 642 (+2575%)
Mutual labels:  widget
Yii2 Fullcalendar
Widget for Yii Framework 2.0 to use FullCalendar
Stars: ✭ 5 (-79.17%)
Mutual labels:  widget
Moon Phase Widget
Moon phase widget for website in javascript
Stars: ✭ 19 (-20.83%)
Mutual labels:  widget
Pinterestsegment
A Pinterest-like segment control with masking animation.
Stars: ✭ 560 (+2233.33%)
Mutual labels:  widget
Energybar
Supercharge your Mac's Touch Bar.
Stars: ✭ 720 (+2900%)
Mutual labels:  widget
Table calendar
Highly customizable, feature-packed Flutter Calendar with gestures, animations and multiple formats
Stars: ✭ 897 (+3637.5%)
Mutual labels:  widget
Vue Page Designer
Vue component for drag-and-drop to design and build mobile website.
Stars: ✭ 702 (+2825%)
Mutual labels:  widget
Softmaskforugui
UI Soft Mask is a smooth masking component for Unity UI (uGUI) elements.
Stars: ✭ 688 (+2766.67%)
Mutual labels:  mask

This repo only supports NativeScript pre-6.0. The latest version of the plugin supporting NS 6+ is availble as part of ProPlugins.

NativeScript Masked Text Field widget

Build Status npm downloads npm downloads npm

A NativeScript Masked Text Field widget. The widget extends the default NativeScript TextField widget and adds ability to define masks for the input.

Screenshot

Screenshot of iOS and Android

Installation

Run the following command from the root of your project:

tns plugin add nativescript-masked-text-field

This command automatically installs the necessary files, as well as stores nativescript-masked-text-field as a dependency in your project's package.json file.

Configuration

There is no additional configuration needed!

API

NOTE: Since the widget extends the default TextFeild NatvieScript widget it has all the properties/events/methods of the TextField widget. The below-mentioned properties are in addition to the TextField ones

Instance Properties

  • mask - string
    Gets or sets the mask for the text field. Possible tokens in the mask:

    • 0 - Digit
    • 9 - Digit or space
    • # - Digit or + or -
    • L - ASCII Letter
    • ? - ASCII Letter or space
    • & - Non-whitepsace character
    • C - Any charcter
    • A - ASCII Letter or digit
    • a - ASCII Letter or digit or space

    If you want to escape any token character you can use \ (for example \9)

Usage

You need to add xmlns:mtf="nativescript-masked-text-field" to your page tag, and then simply use <mtf:MaskedTextField/> in order to add the widget to your page.

<!-- test-page.xml -->
<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:mtf="nativescript-masked-text-field">
    <StackLayout>
        <mtf:MaskedTextField text="{{ value }}" mask="(999) 999-9999" keyboardType="phone"/>
    </StackLayout>
</Page>

Usage in Angular

In order to be able to use the widget you just need to import MaskedTextFieldModule in NgModule:

import { MaskedTextFieldModule } from "nativescript-masked-text-field/angular";
// ......
@NgModule({
    // ......
    imports: [
        // ......
        MaskedTextFieldModule,
        // ......
    ],
    // ......
})
Example Usage
// main.ts
import { NgModule } from "@angular/core";
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
import { platformNativeScriptDynamic } from "nativescript-angular/platform";
import { MaskedTextFieldModule } from "nativescript-masked-text-field/angular";
import { AppComponent } from "./app.component";

@NgModule({
    declarations: [ AppComponent ],
    bootstrap:    [ AppComponent ],
    imports:      [
        NativeScriptModule,
        MaskedTextFieldModule,
    ],
})
class AppComponentModule {
}

platformNativeScriptDynamic().bootstrapModule(AppComponentModule);
<!-- app.component.html -->
<StackLayout>
    <MaskedTextField class="input input-border" mask="(999) 999-9999" [(ngModel)]="value" keyboardType="phone"></MaskedTextField>
</StackLayout>
// app.component.ts
import { Component } from "@angular/core";

@Component({
    selector: "my-app",
    templateUrl:"app.component.html",
})
export class AppComponent {
    public value = "";
}

Demos

This repository includes both Angular and plain NativeScript demos. In order to run those execute the following in your shell:

$ git clone https://github.com/peterstaev/nativescript-masked-text-field
$ cd nativescript-masked-text-field
$ npm install
$ npm run demo-ios

This will run the plain NativeScript demo project on iOS. If you want to run it on Android simply use the -android instead of the -ios sufix.

If you want to run the Angular demo simply use the demo-ng- prefix instead of demo-.

Donate

Donate

bitcoin:14fjysmpwLvSsAskvLASw6ek5XfhTzskHC

Donate

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].