All Projects โ†’ EddyVerbruggen โ†’ Nativescript Keyboard Toolbar

EddyVerbruggen / Nativescript Keyboard Toolbar

Licence: apache-2.0
โŒจ๏ธ๐Ÿ› Add a customizable toolbar on top of the soft keyboard

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Nativescript Keyboard Toolbar

nativescript-numeric-keyboard
๐Ÿ”ข Replace the meh default number/phone keyboard with this stylish one
Stars: โœญ 33 (-50%)
Mutual labels:  keyboard, nativescript
FormToolbar
Simple, movable and powerful toolbar for UITextField and UITextView.
Stars: โœญ 85 (+28.79%)
Mutual labels:  keyboard, toolbar
Keyboardheightprovider
Get android keyboard height using an overlay popup-window
Stars: โœญ 50 (-24.24%)
Mutual labels:  keyboard
On Screen Keyboard
A jQuery plug-in which provides users with a fluid-width on-screen keyboard.
Stars: โœญ 63 (-4.55%)
Mutual labels:  keyboard
Whitefox Keyboard Macos Configuration
โŒจ A macOS compatible configuration for Matt3o's Whitefox keyboard.
Stars: โœญ 53 (-19.7%)
Mutual labels:  keyboard
Keyboardlayoutguide
โŒจ๏ธ Manage iOS keyboard with Apple's missing KeyboardLayoutGuide
Stars: โœญ 1,054 (+1496.97%)
Mutual labels:  keyboard
Keyboardhidemanager
Codeless manager to hide keyboard by tapping on views for iOS written in Swift
Stars: โœญ 57 (-13.64%)
Mutual labels:  keyboard
Atreis
Stars: โœญ 48 (-27.27%)
Mutual labels:  keyboard
Tc Material Design
Sรฉrie de artigos sobre o Material Design Android
Stars: โœญ 64 (-3.03%)
Mutual labels:  toolbar
Badusb
Personal implementation of the BadUSB exploit with an Atmel 8-bit AVR ATTiny85 acting as a HID keyboard
Stars: โœญ 53 (-19.7%)
Mutual labels:  keyboard
Qwerty Lafayette
QWERTY keyboard layout for French-speaking users
Stars: โœญ 60 (-9.09%)
Mutual labels:  keyboard
Libcorsairrgb
โŒจ๏ธ Windows library for controlling lights on Corsair RGB keyboards
Stars: โœญ 52 (-21.21%)
Mutual labels:  keyboard
Capsicain
Powerful low-level keyboard remapping tool for Windows
Stars: โœญ 51 (-22.73%)
Mutual labels:  keyboard
Jetchat
ย Swift5.0็ผ–ๅ†™็š„็ฎ€ไปฟๅพฎไฟก่Šๅคฉๅบ”็”จ๏ผŒๅฎŒ็พŽๆ”ฏๆŒ่กจๆƒ…้”ฎ็›˜ใ€ๅ•่Šใ€็พค่Šใ€ๆœฌๅœฐๆถˆๆฏไผš่ฏ็ผ“ๅญ˜ใ€‚
Stars: โœญ 61 (-7.58%)
Mutual labels:  keyboard
React Native Collapsible Toolbar
Pure JS based collapsible toolbar for react native on Android and iOS
Stars: โœญ 50 (-24.24%)
Mutual labels:  toolbar
Kuikeyboard
Keyboard Handler in iOS
Stars: โœญ 64 (-3.03%)
Mutual labels:  keyboard
Nativescript Urlhandler
NativeScript URL Handler Plugin
Stars: โœญ 49 (-25.76%)
Mutual labels:  nativescript
Nativescript Fresco
This repository holds the NativeScript plugin that exposes the functionality of the Fresco image library to NativeScript developers.
Stars: โœญ 51 (-22.73%)
Mutual labels:  nativescript
Leaflet Geoman
๐Ÿ‚๐Ÿ—บ๏ธ The most powerful leaflet plugin for drawing and editing geometry layers
Stars: โœญ 1,088 (+1548.48%)
Mutual labels:  toolbar
Nativescript Ionic Template
๐Ÿ“ฑ ๐Ÿ–ฅ Create Mobile First apps, Web and Native sharing the code with Angular ๐ŸŽ‰
Stars: โœญ 65 (-1.52%)
Mutual labels:  nativescript

NativeScript Keyboard Toolbar

Build Status NPM version Downloads Twitter Follow

iOS and Android running the included demo - much better framerate on YouTube!

What The Keyboard!?

Glad you asked ๐Ÿ˜…!

  • โŒจ๏ธ Mobile keyboards are a compromise at best. Let's make them easier to work with by attaching a toolbar on top of it.
  • ๐Ÿฅ… Design goal = declare any NativeScript layout and stick it on top of the soft keyboard.
  • ๐Ÿ’ Make the toolbar stick to the keyboard, no matter its shape or form.
  • ๐Ÿ™…โ€โ™€๏ธ No third party dependencies; use only stuff from tns-core-modules (which your app already has).
  • โ™พ Allow multiple toolbar designs on one page.

Installation

tns plugin add nativescript-keyboard-toolbar

General usage instructions

The plugin works by grabbing your declared toolbar layout and moving it off-screen.

Then, whenever the related TextField or TextView received focus, the plugin animates the toolbar to the top of the keyboard and keeps it there until the field loses focus.

For this to behave properly you'll need to grab any layout you currently have and wrap it in a GridLayout as show in the examples below. The GridLayout allows for stacking multiple child layout on top of each other when their row and col properties are equal (or omitted).

So if your layout structure is currently this:

<ActionBar/>
<StackLayout/>

Change it to this:

<ActionBar/>
<GridLayout>
    <StackLayout/>
    <Toolbar/>
</GridLayout>

Not too bad, right? That will make the Toolbar stack on top of the StackLayout you already had.

Note that the plugin could have done this for you, or take some other approach entirely, but many hours of tinkering has convinced me this is the best solution.

Usage with NativeScript Core

Mind the comments in the example below.

<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:kt="nativescript-keyboard-toolbar">

    <!-- This GridLayout wrapper is required; it wraps the visible layout and the Toolbar layout(s) -->
    <GridLayout>

        <StackLayout>
            <Label text="Some text"/>
            <!-- Add an 'id' property that we can reference below -->
            <TextField id="priceTextField" hint="Enter the price" keyboardType="number"/>
        </StackLayout>

        <!-- The 'forId' and 'height' properties are mandatory -->
        <kt:Toolbar forId="priceTextField" height="44">
            <GridLayout columns="*, *, *" class="toolbar">
                <Label col="0" text="๐Ÿ‘" tap="{{ appendToTextView }}"/>
                <Label col="1" text="๐Ÿ‘Ž" tap="{{ appendToTextView }}"/>
                <Label col="2" text="๐Ÿ˜„" tap="{{ appendToTextView }}"/>
            </GridLayout>
        </kt:Toolbar>

    </GridLayout>
</Page>

Core demo app

Check the source in the demo folder, or run it on your own device:

git clone https://github.com/EddyVerbruggen/nativescript-keyboard-toolbar
cd nativescript-keyboard-toolbar/src
npm i
npm run demo.ios # or .android

Usage with NativeScript-Angular

Register the plugin in a specific module, or globally in the app module:

import { registerElement } from "nativescript-angular";
registerElement("KeyboardToolbar", () => require("nativescript-keyboard-toolbar").Toolbar);

In this example, we're adding a TextField to the ActionBar. Note that we still need to wrap the rest of the page in a GridLayout:

<ActionBar>
  <TextField #textField1 id="tf1"></TextField>
</ActionBar>

<!-- Our Toolbar wrapper - no need for 'columns' / 'rows' properties because we want the children to stack -->
<GridLayout>

  <!-- Add whatever visible layout you need here -->
  <ListView [items]="items">
    <ng-template let-item="item">
      <Label [nsRouterLink]="['/item', item.id]" [text]="item.name" class="list-group-item"></Label>
    </ng-template>
  </ListView>

  <!-- Use 'KeyboardToolbar' because that's what we registered in our module (see above).
   The 'forId' and 'height' properties are mandatory -->
  <KeyboardToolbar forId="tf1" height="44">
    <GridLayout columns="*, *, *, auto" class="toolbar">
      <Label col="0" text="๐Ÿ‘" (tap)="appendToTextField(textField1, '๐Ÿ‘')"></Label>
      <Label col="1" text="๐Ÿ‘Ž" (tap)="appendToTextField(textField1, '๐Ÿ‘Ž')"></Label>
      <Label col="2" text="๐Ÿ˜„" (tap)="appendToTextField(textField1, '๐Ÿ˜„')"></Label>
      <Label col="3" text="Close๏ธ" (tap)="closeKeyboard(textField1)"></Label>
    </GridLayout>
  </KeyboardToolbar>
</GridLayout>

Angular demo app

Check the source in the demo-ng folder, or run it on your own device:

git clone https://github.com/EddyVerbruggen/nativescript-keyboard-toolbar
cd nativescript-keyboard-toolbar/src
npm i
npm run demo-ng.ios # or .android

Usage with NativeScript-Vue

Register the plugin in app.js (or depending on your app's setup: app.ts, or main.js, etc):

import Vue from "nativescript-vue";
Vue.registerElement('KeyboardToolbar', () => require('nativescript-keyboard-toolbar').Toolbar);
<template>
  <Page class="page">
    <ActionBar class="action-bar">
      <Label class="action-bar-title" text="Home"></Label>
    </ActionBar>

    <!-- Our Toolbar wrapper - no need for 'columns' / 'rows' properties because we want the children to stack -->
    <GridLayout>

      <StackLayout>
        <TextView id="tv2" text="Say it with emoji!"/>
      </StackLayout>

      <!-- Use 'KeyboardToolbar' because that's what we registered in our module (see above).
         The 'forId' and 'height' properties are mandatory -->
      <KeyboardToolbar forId="tv2" height="44">
        <GridLayout columns="*, *, *" class="toolbar">
          <Label col="0" text="๐Ÿ‘" @tap="appendToTextView2"/>
          <Label col="1" text="๐Ÿ‘Ž" @tap="appendToTextView2"/>
          <Label col="2" text="๐Ÿ˜„" @tap="appendToTextView2"/>
        </GridLayout>
      </KeyboardToolbar>

    </GridLayout>
  </Page>
</template>

<script>
  import { topmost } from "tns-core-modules/ui/frame";

  export default {
    methods: {
      appendToTextView2(args) {
        const textView = topmost().currentPage.getViewById("tv2");
        textView.text += args.object.text;
      }
    }
  }
</script>

Vue demo app

Check the source in the demo-vue folder, or run it on your own device:

git clone https://github.com/EddyVerbruggen/nativescript-keyboard-toolbar
cd nativescript-keyboard-toolbar/src
npm i
npm run demo-vue.ios # or .android

What about IQKeyboardManager?

If you have IQKeyboardManager installed for better keyboard behavior on iOS, then this plugin will detect it and add the height of your custom toolbar to the scroll offset IQKeyboardManager applies. You can see this in action in the NativeScript Core demo app.

You may want to suppress IQKeyboardManager's own toolbar in this case (to avoid a double toolbar), as shown here.

Future work

  • Orientation-change support.
  • Dismiss keyboard on iOS when tapping outside the keyboard (configurable). Fot the time being you can add and configure IQKeyboardManager as mentioned above.
  • Auto-scroll the view if the keyboard overlaps the text field (on iOS you can already do that with IQKeyboardManager).
  • Modal support on Android (currently you can't use the toolbar in a modal because the toolbar is behind the modal)
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].