GithubHelp home page GithubHelp logo

cordova-keyboard's Introduction

Keyboard

The Keyboard object provides some functions to customize the iOS keyboard.

This plugin has only been tested in Cordova 3.2 or greater, and its use in previous Cordova versions is not recommended (potential conflict with keyboard customization code present in the core in previous Cordova versions).

If you do use this plugin in an older Cordova version (again, not recommended), you have to make sure the HideKeyboardFormAccessoryBar and KeyboardShrinksView preference values are always false, and only use the API functions to turn things on/off.

This plugin supports the HideKeyboardFormAccessoryBar (boolean) and KeyboardShrinksView (boolean) preferences in config.xml.

Methods

  • Keyboard.shrinkView
  • Keyboard.hideFormAccessoryBar
  • Keyboard.disableScrollingInShrinkView

Properties

  • Keyboard.isVisible

Events

  • Keyboard.onshow
  • Keyboard.onhide
  • Keyboard.onshowing
  • Keyboard.onhiding

Permissions

config.xml

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

Keyboard.shrinkView

Shrink the WebView when the keyboard comes up.

Keyboard.shrinkView(true);

Description

Set to true to shrink the WebView when the keyboard comes up. The WebView shrinks instead of the viewport shrinking and the page scrollable. This applies to apps that position their elements relative to the bottom of the WebView. This is the default behaviour on Android, and makes a lot of sense when building apps as opposed to webpages.

Supported Platforms

  • iOS

Quick Example

Keyboard.shrinkView(true);
Keyboard.shrinkView(false);

Keyboard.hideFormAccessoryBar

Hide the keyboard toolbar.

Keyboard.hideFormAccessoryBar(true);

Description

Set to true to hide the additional toolbar that is on top of the keyboard. This toolbar features the Prev, Next, and Done buttons.

Supported Platforms

  • iOS

Quick Example

Keyboard.hideFormAccessoryBar(true);
Keyboard.hideFormAccessoryBar(false);

Keyboard.disableScrollingInShrinkView

Disable scrolling when the the WebView is shrunk.

Keyboard.disableScrollingInShrinkView(true);

Description

Set to true to disable scrolling when the WebView is shrunk.

Supported Platforms

  • iOS

Quick Example

Keyboard.disableScrollingInShrinkView(true);
Keyboard.disableScrollingInShrinkView(false);

Keyboard.isVisible

Determine if the keyboard is visible.

if (Keyboard.isVisible) {
    // do something
}

Description

Read this property to determine if the keyboard is visible.

Supported Platforms

  • iOS

Keyboard.automaticScrollToTopOnHiding

Specifies whenether content of page would be autoamtically scrolled to the top of the page when keyboard is hiding.

Keyboard.automaticScrollToTopOnHiding = true;

Description

Set this to true if you need that page scroll to beginning when keyboard is hiding. This is allows to fix issue with elements declared with position: fixed, after keyboard is hiding.

Supported Platforms

  • iOS

Keyboard.onshow

If defined, this function fired when keyboard fully shown.

Keyboard.onshow = function () {
    // Describe your logic which will be run each time keyboard is shown.
}

Description

Attach handler to this event to be able to receive notification when keyboard is shown.

Supported Platforms

  • iOS

Keyboard.onhide

If defined, this function fired when keyboard fully closed.

Keyboard.onhide = function () {
    // Describe your logic which will be run each time keyboard is closed.
}

Description

Attach handler to this event to be able to receive notification when keyboard is closed.

Supported Platforms

  • iOS

Keyboard.onshowing

If defined, this function fired before keyboard will be shown.

Keyboard.onshowing = function () {
    // Describe your logic which will be run each time when keyboard is about to be shown.
}

Description

Attach handler to this event to be able to receive notification when keyboard is about to be shown on the screen.

Supported Platforms

  • iOS

Keyboard.onhiding

If defined, this function fired when keyboard fully closed.

Keyboard.onhiding = function () {
    // Describe your logic which will be run each time when keyboard is about to be closed.
}

Description

Attach handler to this event to be able to receive notification when keyboard is about to be closed.

Supported Platforms

  • iOS

cordova-keyboard's People

Contributors

martinmose avatar

Stargazers

Josh Hunt avatar Dan Klammer avatar

Watchers

 avatar James Cloos avatar  avatar

cordova-keyboard's Issues

Can't get this plugin to work

Can you provide me a sample please? I for whatever reason can not get this plugin to work.

Thank you

God bless
jason

Interferes with SplashScreen and Alerts

Hello,

I found a weird issue, that seems to be caused by this plugin.
(Disabling the plugin makes the problem go away.)

Occasionally the splash screen won't disappear, if I swipe down from the top, or up from the bottom so that it opens the notification center then the splash screen disappears.

Also, if I have a Cordova alert, it won't show until I swipe down from the top, up from the bottom or hit the home button and go back into the app.

Most unusual, its like the plugin is preventing the other native functions from working until an external event occurs forcing a redraw. Have you noticed anything similar? Thoughts? Workarounds?

I'll work on making a simplified basic project that shows this.
Any insight you can provide would be most appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.