From fbf7463724ae8bf7e4916fa6ec2efc90671dd1c3 Mon Sep 17 00:00:00 2001 From: Ken Sodemann Date: Tue, 25 Sep 2018 09:45:43 -0500 Subject: [PATCH] fix(keyboard): use cordova-plugin-ionic-keyboard (#2743) Previous was using the deprecated keyboard plugin. Fixes #2306 --- src/@ionic-native/plugins/keyboard/index.ts | 63 ++++++++++++++------- 1 file changed, 44 insertions(+), 19 deletions(-) diff --git a/src/@ionic-native/plugins/keyboard/index.ts b/src/@ionic-native/plugins/keyboard/index.ts index 64f3a2092e..7280d291b7 100644 --- a/src/@ionic-native/plugins/keyboard/index.ts +++ b/src/@ionic-native/plugins/keyboard/index.ts @@ -7,7 +7,7 @@ import { Observable } from 'rxjs'; * @description * Keyboard plugin for Cordova. * - * Requires Cordova plugin: `ionic-plugin-keyboard`. For more info, please see the [Keyboard plugin docs](https://github.com/ionic-team/ionic-plugin-keyboard). + * Requires Cordova plugin: `cordova-plugin-ionic-keyboard`. For more info, please see the [Keyboard plugin docs](https://github.com/ionic-team/cordova-plugin-ionic-keyboard). * * @usage * ```typescript @@ -19,16 +19,16 @@ import { Observable } from 'rxjs'; * * this.keyboard.show(); * - * this.keyboard.close(); + * this.keyboard.hide(); * * ``` */ @Plugin({ pluginName: 'Keyboard', - plugin: 'ionic-plugin-keyboard', - pluginRef: 'cordova.plugins.Keyboard', - repo: 'https://github.com/ionic-team/ionic-plugin-keyboard', - platforms: ['Android', 'BlackBerry 10', 'iOS', 'Windows'] + plugin: 'cordova-plugin-ionic-keyboard', + pluginRef: 'window.Keyboard', + repo: 'https://github.com/ionic-team/cordova-plugin-ionic-keyboard', + platforms: ['Android', 'iOS'] }) @Injectable() export class Keyboard extends IonicNativePlugin { @@ -37,35 +37,34 @@ export class Keyboard extends IonicNativePlugin { * @param hide {boolean} */ @Cordova({ sync: true }) - hideKeyboardAccessoryBar(hide: boolean): void {} + hideFormAccessoryBar(hide: boolean): void {} /** - * Force keyboard to be shown. + * Hide the keyboard if shown. */ @Cordova({ sync: true, - platforms: ['Android', 'BlackBerry 10', 'Windows'] + platforms: ['iOS', 'Android'] }) - show(): void {} + hide(): void {} /** - * Close the keyboard if open. + * Force keyboard to be shown. */ @Cordova({ sync: true, - platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows'] + platforms: ['Android'] }) - close(): void {} + show(): void {} /** - * Prevents the native UIScrollView from moving when an input is focused. - * @param disable {boolean} + * Programatically set the resize mode */ @Cordova({ sync: true, - platforms: ['iOS', 'Windows'] + platforms: ['iOS'] }) - disableScroll(disable: boolean): void {} + setResizeMode(): void {} /** * Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch. @@ -74,12 +73,25 @@ export class Keyboard extends IonicNativePlugin { @Cordova({ eventObservable: true, event: 'native.keyboardshow', - platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows'] + platforms: ['iOS', 'Android'] }) onKeyboardShow(): Observable { return; } + /** + * Creates an observable that notifies you when the keyboard will show. Unsubscribe to observable to cancel event watch. + * @returns {Observable} + */ + @Cordova({ + eventObservable: true, + event: 'keyboardWillShow', + platforms: ['iOS', 'Android'] + }) + onKeyboardWillShow(): Observable { + return; + } + /** * Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch. * @returns {Observable} @@ -87,9 +99,22 @@ export class Keyboard extends IonicNativePlugin { @Cordova({ eventObservable: true, event: 'native.keyboardhide', - platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows'] + platforms: ['iOS', 'Android'] }) onKeyboardHide(): Observable { return; } + + /** + * Creates an observable that notifies you when the keyboard will hide. Unsubscribe to observable to cancel event watch. + * @returns {Observable} + */ + @Cordova({ + eventObservable: true, + event: 'keyboardWillHide', + platforms: ['iOS', 'Android'] + }) + onKeyboardWillHide(): Observable { + return; + } }