All Projects → EddyVerbruggen → nativescript-numeric-keyboard

EddyVerbruggen / nativescript-numeric-keyboard

Licence: other
🔢 Replace the meh default number/phone keyboard with this stylish one

Programming Languages

typescript
32286 projects
shell
77523 projects
ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to nativescript-numeric-keyboard

Nativescript Keyboard Toolbar
⌨️🛠Add a customizable toolbar on top of the soft keyboard
Stars: ✭ 66 (+100%)
Mutual labels:  keyboard, nativescript
react-native-screen-keyboard
On-screen keyboard with customisable keys and tactile / UI feedback 📱
Stars: ✭ 22 (-33.33%)
Mutual labels:  keyboard
nativescript-image-filters
NativeScript plugin to apply filters to images
Stars: ✭ 30 (-9.09%)
Mutual labels:  nativescript
nativescript-vue-rollup-template
A NativeScript template ready to roll with Vue.js and .vue files.
Stars: ✭ 39 (+18.18%)
Mutual labels:  nativescript
pi400kb
Raw HID keyboard forwarder to turn the Pi 400 into a USB keyboard
Stars: ✭ 182 (+451.52%)
Mutual labels:  keyboard
snake
A stylised graphical tool for configuring and controlling Razer devices on Linux
Stars: ✭ 52 (+57.58%)
Mutual labels:  keyboard
hidstream
Streaming HID events in Node.js
Stars: ✭ 52 (+57.58%)
Mutual labels:  keyboard
KeyboardKitPro
KeyboardKit Pro extends KeyboardKit with pro features.
Stars: ✭ 42 (+27.27%)
Mutual labels:  keyboard
ck550-macos
MacOS effect control SW for a CoolMaster CK550 & CK530 Keyboard (US Layout).
Stars: ✭ 14 (-57.58%)
Mutual labels:  keyboard
nativescript-fancy-calendar
Fancy calendar for NativeScript 😄 🍻
Stars: ✭ 21 (-36.36%)
Mutual labels:  nativescript
nativescript-menu
A plugin that adds a pop-up menu to NativeScript
Stars: ✭ 17 (-48.48%)
Mutual labels:  nativescript
system-76-keyboards
Rainbow / CPU monitor for system76 colored keyboards
Stars: ✭ 37 (+12.12%)
Mutual labels:  keyboard
nativescript-dev-webpack
A package to help with webpacking NativeScript apps.
Stars: ✭ 98 (+196.97%)
Mutual labels:  nativescript
vue-focus-keyboard
A keyboard component for Vue. Start to write immediately. No input element definition. Plug and play!
Stars: ✭ 63 (+90.91%)
Mutual labels:  keyboard
keyboard-css
Show off your keyboard shortcuts with style 🦄.
Stars: ✭ 52 (+57.58%)
Mutual labels:  keyboard
nativescript-ng-shadow
Angular directive to apply shadows to native elements according to the elevation level guidelines of material design specification
Stars: ✭ 54 (+63.64%)
Mutual labels:  nativescript
texttospeech
Text to Speech NativeScript plugin for Android & iOS 📢
Stars: ✭ 44 (+33.33%)
Mutual labels:  nativescript
Kimiko
Build-Guide for the Kimiko Split-Keyboard pcb.
Stars: ✭ 34 (+3.03%)
Mutual labels:  keyboard
dasher-web
Dasher text entry in HTML, CSS, JavaScript, and SVG
Stars: ✭ 34 (+3.03%)
Mutual labels:  keyboard
intuiter
Global productivity app for anyone who use Windows
Stars: ✭ 24 (-27.27%)
Mutual labels:  keyboard

NativeScript Numeric Keyboard

NPM version Downloads Twitter Follow

For iOS. Falls back to the best platform-provided numeric keyboard on Android. Note that the iPad UI looks a bit sleeker than shown in the screenshot below.

BREAKING CHANGE in plugin version 4.0.0: we used to extend a TextView, now it's a TextField, because I finally hacked my way around a problem that prevented a TextField from emitting a textChange event. Note that unless you use the decorate() function this will not affect you (bar some now-fixed UI glitches).

Installation

From the command prompt go to your app's root folder and execute:

Since NativeScript 7

tns plugin add nativescript-numeric-keyboard

Before NativeScript 7

tns plugin add nativescript-numeric-keyboard@4

mind the @4 on the end, because since plugin version 5 we require NativeScript 7.

Demo app

Check out the demo to play with the keyboard. You can run it by typing npm run demo.iphone / npm run demo.ipad at the root of the project.

How it works

This plugin wraps a native keyboard library and extends a regular NativeScript TextField. You can set any property you'd normally set on this widget (class, text, etc) and a few plugin-specific properties as well.

You can either define the keyboard in XML or in code - use whichever tickles your fancy.

Screenshot-driven documentation

After adding the plugin you can add a namespace to your view (using NumKey below) and use the NumericKeyboardView tag to render a TextField powered by this plugin.

<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:NK="nativescript-numeric-keyboard">
  <NK:NumericKeyboardView text="123.45" maxLength="10" returnKeyButtonBackgroundColor="#333333" />
</Page>

For comparison sake we kick off with the default appearance of a TextField and then showcase the various properties this plugin exposes:

Appearance Declaration
<TextField keyboardType="number" text="1.23"/>
<TextField keyboardType="phone" text="12.34"/>
<NK:NumericKeyboardView text="123.45"/>
<NK:NumericKeyboardView returnKeyTitle="OK" text="234.56"/>
<NK:NumericKeyboardView noDecimals="true" text="345"/>
<NK:NumericKeyboardView noReturnKey="true" text="678"/>
<NK:NumericKeyboardView locale="en_US" text="456.78"/>
<NK:NumericKeyboardView locale="nl_NL" text="567,89"/>

iPad appearance

It's similar (although a bit cleaner than in these screenshots), except for some padding on both sides of the keyboard:

Appearance Declaration
<TextField keyboardType="phone" text="12.34"/>
<NK:NumericKeyboard text="123.45"/>

Usage with Vue

Open main.ts (or .js) and add this:

Vue.registerElement('NumericKeyboard', () => require('nativescript-numeric-keyboard').NumericKeyboardView);

Check this registerElement example, and this usage example.

Usage with Angular

Open app.module.ts and add:

import { registerElement } from "nativescript-angular";
registerElement("NumericKeyboard", () => require("nativescript-numeric-keyboard").NumericKeyboardView);

For the views you can take a look at the examples above and just replace NumKey:NumericKeyboardView by NumericKeyboard :

<NumericKeyboard noDecimals="true"></NumericKeyboard>

Programmatic usage

Say you have a plain old TextField in your view:

<Page xmlns="http://schemas.nativescript.org/tns.xsd" loaded="pageLoaded">
  <TextField id="myTextField" maxlength="8" keyboardType="number" text="{{ myTextPlugin }}" />
</Page>

Now you can enhance the TextField with this plugin by doing fi. this in the pageLoaded event you've defined in the <Page> tag above:

import { NumericKeyboard } from "nativescript-numeric-keyboard";
import { Color } from "tns-core-modules/color";

export function pageLoaded(args: observable.EventData) {
  const page = <pages.Page>args.object;
  const textField = <TextField>page.getViewById("myTextField");
  // or even textField.ios

  // this is an example with all possible properties, not that they make sense combined :)
  new NumericKeyboard().decorate({
    textField: textField,
    returnKeyTitle: "Go!",
    locale: "en_US", // or "nl_NL", or any valid locale really (to define the decimal char)
    noReturnKey: true,
    noDecimals: true,
    noIpadInputBar: true, // suppress the bar with buttons iOS renders on iPad since iOS 9
    returnKeyButtonBackgroundColor: new Color("red"), // optional, set this to change the (default) blue color of the 'return' key
    onReturnKeyPressed: (): boolean => {
      // Your code here
      return true; // Return true to hide/collapse the keyboard, use false to keep the keyboard in place.
    }
  });
}

Note that on Android you'll just get a numeric keyboard as usual (since we specified keyboardType="number").

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].