/ionic-plugins-keyboard

Ionic Keyboard Plugin for Cordova

Primary LanguageObjective-CApache License 2.0Apache-2.0

Keyboard

The Keyboard object on the cordova.plugins object provides functions to make interacting with the keyboard easier, and fires events to indicate that the keyboard will hide/show.

cordova plugin add https://github.com/driftyco/ionic-plugins-keyboard.git

Methods

  • cordova.plugins.Keyboard.hideKeyboardAccessoryBar
  • cordova.plugins.Keyboard.close
  • cordova.plugins.Keyboard.disableScroll

Properties

  • cordova.plugins.Keyboard.isVisible

Events

  • native.showkeyboard
  • native.hidekeyboard

Permissions

config.xml

        <feature name="Keyboard">
            <param name="ios-package" value="IonicKeyboard" onload="true" />
        </feature>

Keyboard.hideKeyboardAccessoryBar

Hide the keyboard accessory bar with the next, previous and done buttons.

Keyboard.hideKeyboardAccessoryBar(true);
Keyboard.hideKeyboardAccessoryBar(false);

Supported Platforms

  • iOS

Keyboard.close

Close the keyboard if it is open.

Keyboard.close();

Supported Platforms

  • iOS

Keyboard.disableScroll

Disable native scrolling, useful if you are using JavaScript to scroll

Keyboard.disableScroll();

Supported Platforms

  • iOS

native.showkeyboard

This event fires when the keyboard will be shown

window.addEventListener('native.showkeyboard', keyboardShowHandler);

function keyboardShowHandler(e){
    alert('Keyboard height is: ' + e.keyboardHeight);
}

Properties

keyboardHeight: the height of the keyboard in pixels

Supported Platforms

  • iOS, Android

native.hidekeyboard

This event fires when the keyboard will hide

window.addEventListener('native.hidekeyboard', keyboardHideHandler);

function keyboardHideHandler(e){
    alert('Goodnight, sweet prince');
}

Properties

None

Supported Platforms

  • iOS, Android