mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 06:29:40 +08:00
Merge pull request #21674 from MobisysGmbH/master
[cordova-plugin-keyboard] update to version 1.2.0
This commit is contained in:
@@ -1,23 +1,31 @@
|
||||
Keyboard.shrinkView(true);
|
||||
Keyboard.shrinkView(false);
|
||||
Keyboard.shrinkView(null, (currentValue) => console.log(currentValue));
|
||||
|
||||
Keyboard.hideFormAccessoryBar(true);
|
||||
Keyboard.hideFormAccessoryBar(false);
|
||||
Keyboard.hideFormAccessoryBar(null, (currentValue) => console.log(currentValue));
|
||||
|
||||
Keyboard.disableScrollingInShrinkView(true);
|
||||
Keyboard.disableScrollingInShrinkView(false);
|
||||
Keyboard.disableScrollingInShrinkView(null, (currentValue) => console.log(currentValue));
|
||||
|
||||
Keyboard.hide();
|
||||
|
||||
Keyboard.show();
|
||||
|
||||
if (Keyboard.isVisible) {
|
||||
console.log('Keyboard is visible');
|
||||
}
|
||||
Keyboard.automaticScrollToTopOnHiding = true;
|
||||
Keyboard.onshow = function () {
|
||||
console.log('onshow');
|
||||
};
|
||||
Keyboard.onhide = function () {
|
||||
console.log('onhide');
|
||||
};
|
||||
Keyboard.onshowing = function () {
|
||||
console.log('onshowing');
|
||||
};
|
||||
Keyboard.onhiding= function () {
|
||||
console.log('onhiding');
|
||||
};
|
||||
|
||||
Keyboard.automaticScrollToTopOnHiding = true;
|
||||
|
||||
window.addEventListener('keyboardDidShow', () => console.log('keyboardDidShow'));
|
||||
|
||||
window.addEventListener('keyboardDidHide', () => console.log('keyboardDidHide'));
|
||||
|
||||
window.addEventListener('keyboardWillShow', () => console.log('keyboardWillShow'));
|
||||
|
||||
window.addEventListener('keyboardWillHide', () => console.log('keyboardWillHide'));
|
||||
|
||||
window.addEventListener('keyboardHeightWillChange', (event: CordovaKeyboardEvent) => console.log(`keyboardHeightWillChange - keyboard height: ${event.keyboardHeight}`));
|
||||
|
||||
187
types/cordova-plugin-keyboard/index.d.ts
vendored
187
types/cordova-plugin-keyboard/index.d.ts
vendored
@@ -1,32 +1,9 @@
|
||||
// Type definitions for Apache Cordova Keyboard plugin v0.1.2
|
||||
// Project: https://github.com/apache/cordova-plugins/tree/master/keyboard
|
||||
// Definitions by: Dan Manastireanu <https://github.com/danmana>
|
||||
// Type definitions for Apache Cordova Keyboard plugin v1.2.0
|
||||
// Project: https://github.com/cjpearson/cordova-plugin-keyboard
|
||||
// Definitions by: Dan Manastireanu <https://github.com/danmana>
|
||||
// Jochen Becker <https://github.com/jkfb>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* The Keyboard object provides some functions to customize the iOS keyboard.
|
||||
*
|
||||
* <i>Supported Platforms: iOS</i>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Permissions in config.xml
|
||||
* <code>
|
||||
* <feature name="Keyboard">
|
||||
* <param name="ios-package" value="CDVKeyboard" onload="true" />
|
||||
* </feature>
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
interface Keyboard {
|
||||
|
||||
// Methods
|
||||
@@ -39,15 +16,20 @@ interface Keyboard {
|
||||
* 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
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.shrinkView(true);
|
||||
* Keyboard.shrinkView(false);
|
||||
* Keyboard.shrinkView(null, function (currentValue) { console.log(currentValue); });
|
||||
* </code>
|
||||
*
|
||||
* @param shrink
|
||||
* @param successCallback A success callbackfunction
|
||||
*/
|
||||
shrinkView(shrink:boolean): void,
|
||||
shrinkView(shrink: boolean, successCallback?: (currentValue: any) => void): void,
|
||||
|
||||
/**
|
||||
* Hide the keyboard toolbar.
|
||||
@@ -55,21 +37,29 @@ interface Keyboard {
|
||||
* 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
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.hideFormAccessoryBar(true);
|
||||
* Keyboard.hideFormAccessoryBar(false);
|
||||
* Keyboard.hideFormAccessoryBar(null, function (currentValue) { console.log(currentValue); });
|
||||
* </code>
|
||||
*
|
||||
* @param hide
|
||||
* @param successCallback A success callbackfunction
|
||||
*/
|
||||
hideFormAccessoryBar(hide:boolean): void,
|
||||
hideFormAccessoryBar(hide: boolean, successCallback?: (currentValue: any) => void): void,
|
||||
|
||||
/**
|
||||
* Disable scrolling when the the WebView is shrunk.
|
||||
*
|
||||
* Set to true to disable scrolling when the WebView is shrunk.
|
||||
*
|
||||
* Supported Platforms:
|
||||
* - iOS
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.disableScrollingInShrinkView(true);
|
||||
@@ -77,8 +67,40 @@ interface Keyboard {
|
||||
* </code>
|
||||
*
|
||||
* @param disable
|
||||
* @param successCallback A success callbackfunction
|
||||
*/
|
||||
disableScrollingInShrinkView(disable:boolean): void,
|
||||
disableScrollingInShrinkView(disable: boolean, successCallback?: (currentValue: any) => void): void,
|
||||
|
||||
/**
|
||||
* Hide the keyboard
|
||||
*
|
||||
* Call this method to hide the keyboard
|
||||
*
|
||||
* Supported Platforms:
|
||||
* - iOS
|
||||
* - Android
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.hide();
|
||||
* </code>
|
||||
*/
|
||||
hide(): void,
|
||||
|
||||
/**
|
||||
* Show the keyboard
|
||||
*
|
||||
* Call this method to show the keyboard.
|
||||
*
|
||||
* Supported Platforms:
|
||||
* - Android
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.show();
|
||||
* </code>
|
||||
*/
|
||||
show(): void,
|
||||
|
||||
// Properties
|
||||
|
||||
@@ -87,6 +109,9 @@ interface Keyboard {
|
||||
*
|
||||
* Read this property to determine if the keyboard is visible.
|
||||
*
|
||||
* Supported Platforms:
|
||||
* - iOS
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* if (Keyboard.isVisible) {
|
||||
@@ -102,6 +127,9 @@ interface Keyboard {
|
||||
* 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
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.automaticScrollToTopOnHiding = true;
|
||||
@@ -110,65 +138,48 @@ interface Keyboard {
|
||||
*/
|
||||
automaticScrollToTopOnHiding: boolean,
|
||||
|
||||
// Events
|
||||
/**
|
||||
* Deprecated Events
|
||||
*/
|
||||
onshow(): void,
|
||||
|
||||
/**
|
||||
* If defined, this function is fired when keyboard fully shown.
|
||||
*
|
||||
* Attach handler to this event to be able to receive notification when keyboard is shown.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.onshow = function () {
|
||||
* // Describe your logic which will be run each time keyboard is shown.
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
onshow():void,
|
||||
/**
|
||||
* If defined, this function is fired when keyboard fully closed.
|
||||
*
|
||||
* Attach handler to this event to be able to receive notification when keyboard is closed.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.onhide = function () {
|
||||
* // Describe your logic which will be run each time keyboard is closed.
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
onhide():void,
|
||||
/**
|
||||
* If defined, this function is fired before keyboard will be shown.
|
||||
*
|
||||
* Attach handler to this event to be able to receive notification when keyboard is about to be shown on the screen.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.onshowing = function () {
|
||||
* // Describe your logic which will be run each time when keyboard is about to be shown.
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
onshowing():void,
|
||||
/**
|
||||
* If defined, this function is fired when keyboard is about to be closed.
|
||||
*
|
||||
* Attach handler to this event to be able to receive notification when keyboard is about to be closed.
|
||||
*
|
||||
* Example:
|
||||
* <code>
|
||||
* Keyboard.onhiding = function () {
|
||||
* // Describe your logic which will be run each time when keyboard is about to be closed.
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
*/
|
||||
onhiding():void,
|
||||
onhide(): void,
|
||||
|
||||
onhiding(): void,
|
||||
|
||||
onshowing(): void
|
||||
}
|
||||
|
||||
declare var Keyboard:Keyboard;
|
||||
interface CordovaKeyboardEvent extends Event {
|
||||
/** The height of the keyboard */
|
||||
keyboardHeight: number;
|
||||
}
|
||||
|
||||
interface WindowEventMap {
|
||||
/**
|
||||
* This event is fired when keyboard fully shown.
|
||||
*/
|
||||
'keyboardDidShow': Event,
|
||||
|
||||
/**
|
||||
* This event is fired when the keyboard is fully closed.
|
||||
*/
|
||||
'keyboardDidHide': Event,
|
||||
|
||||
/**
|
||||
* This event fires before keyboard will be shown.
|
||||
*/
|
||||
'keyboardWillShow': Event,
|
||||
|
||||
/**
|
||||
* This event is fired when the keyboard is fully closed.
|
||||
*/
|
||||
'keyboardWillHide': Event,
|
||||
|
||||
/**
|
||||
* This event is fired when the keyboard is fully closed.
|
||||
*/
|
||||
'keyboardHeightWillChange': CordovaKeyboardEvent
|
||||
}
|
||||
|
||||
declare var Keyboard: Keyboard;
|
||||
|
||||
Reference in New Issue
Block a user