From a1fb93707f1f4dc538f57992e2f29a2ca31215cb Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Fri, 4 Oct 2019 16:31:50 +0200 Subject: [PATCH] fix(keyboard): Update types with new 2.2.0 methods (#3187) --- src/@ionic-native/plugins/keyboard/index.ts | 66 ++++++++++++++++++++- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/src/@ionic-native/plugins/keyboard/index.ts b/src/@ionic-native/plugins/keyboard/index.ts index 0aa4e512c2..e4416ae776 100644 --- a/src/@ionic-native/plugins/keyboard/index.ts +++ b/src/@ionic-native/plugins/keyboard/index.ts @@ -2,6 +2,19 @@ import { Injectable } from '@angular/core'; import { Cordova, IonicNativePlugin, Plugin } from '@ionic-native/core'; import { Observable } from 'rxjs'; +export enum KeyboardStyle { + Light = 'light', + Dark = 'dark' +} + +export enum KeyboardResizeMode { + Native = 'native', + Ionic = 'ionic', + Body = 'body', + None = 'none' +} + + /** * @name Keyboard * @description @@ -43,7 +56,10 @@ export class Keyboard extends IonicNativePlugin { * Hide the keyboard accessory bar with the next, previous and done buttons. * @param hide {boolean} */ - @Cordova({ sync: true }) + @Cordova({ + sync: true, + platforms: ['iOS'] + }) hideFormAccessoryBar(hide: boolean): void {} /** @@ -72,7 +88,27 @@ export class Keyboard extends IonicNativePlugin { sync: true, platforms: ['iOS'] }) - setResizeMode(mode: string): void {} + setResizeMode(mode: KeyboardResizeMode): void {} + + /** + * Programatically set Keyboard style + * @param mode {string} + */ + @Cordova({ + sync: true, + platforms: ['iOS'] + }) + setKeyboardStyle(style: KeyboardStyle): void {} + + /** + * Programatically enable or disable the WebView scroll + * @param mode {string} + */ + @Cordova({ + sync: true, + platforms: ['iOS'] + }) + disableScroll(disable: boolean): void {} /** * Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch. @@ -100,6 +136,19 @@ export class Keyboard extends IonicNativePlugin { return; } + /** + * Creates an observable that notifies you when the keyboard did show. Unsubscribe to observable to cancel event watch. + * @returns {Observable} + */ + @Cordova({ + eventObservable: true, + event: 'keyboardDidShow', + platforms: ['iOS', 'Android'] + }) + onKeyboardDidShow(): Observable { + return; + } + /** * Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch. * @returns {Observable} @@ -125,4 +174,17 @@ export class Keyboard extends IonicNativePlugin { onKeyboardWillHide(): Observable { return; } + + /** + * Creates an observable that notifies you when the keyboard did hide. Unsubscribe to observable to cancel event watch. + * @returns {Observable} + */ + @Cordova({ + eventObservable: true, + event: 'keyboardDidHide', + platforms: ['iOS', 'Android'] + }) + onKeyboardDidHide(): Observable { + return; + } }