fix(keyboard): use cordova-plugin-ionic-keyboard (#2743)

Previous was using the deprecated keyboard plugin.

Fixes #2306
This commit is contained in:
Ken Sodemann 2018-09-25 09:45:43 -05:00 committed by Daniel Sogl
parent cbeb4139d9
commit fbf7463724

View File

@ -7,7 +7,7 @@ import { Observable } from 'rxjs';
* @description * @description
* Keyboard plugin for Cordova. * 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 * @usage
* ```typescript * ```typescript
@ -19,16 +19,16 @@ import { Observable } from 'rxjs';
* *
* this.keyboard.show(); * this.keyboard.show();
* *
* this.keyboard.close(); * this.keyboard.hide();
* *
* ``` * ```
*/ */
@Plugin({ @Plugin({
pluginName: 'Keyboard', pluginName: 'Keyboard',
plugin: 'ionic-plugin-keyboard', plugin: 'cordova-plugin-ionic-keyboard',
pluginRef: 'cordova.plugins.Keyboard', pluginRef: 'window.Keyboard',
repo: 'https://github.com/ionic-team/ionic-plugin-keyboard', repo: 'https://github.com/ionic-team/cordova-plugin-ionic-keyboard',
platforms: ['Android', 'BlackBerry 10', 'iOS', 'Windows'] platforms: ['Android', 'iOS']
}) })
@Injectable() @Injectable()
export class Keyboard extends IonicNativePlugin { export class Keyboard extends IonicNativePlugin {
@ -37,35 +37,34 @@ export class Keyboard extends IonicNativePlugin {
* @param hide {boolean} * @param hide {boolean}
*/ */
@Cordova({ sync: true }) @Cordova({ sync: true })
hideKeyboardAccessoryBar(hide: boolean): void {} hideFormAccessoryBar(hide: boolean): void {}
/**
* Hide the keyboard if shown.
*/
@Cordova({
sync: true,
platforms: ['iOS', 'Android']
})
hide(): void {}
/** /**
* Force keyboard to be shown. * Force keyboard to be shown.
*/ */
@Cordova({ @Cordova({
sync: true, sync: true,
platforms: ['Android', 'BlackBerry 10', 'Windows'] platforms: ['Android']
}) })
show(): void {} show(): void {}
/** /**
* Close the keyboard if open. * Programatically set the resize mode
*/ */
@Cordova({ @Cordova({
sync: true, sync: true,
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows'] platforms: ['iOS']
}) })
close(): void {} setResizeMode(): void {}
/**
* Prevents the native UIScrollView from moving when an input is focused.
* @param disable {boolean}
*/
@Cordova({
sync: true,
platforms: ['iOS', 'Windows']
})
disableScroll(disable: boolean): void {}
/** /**
* Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch. * 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({ @Cordova({
eventObservable: true, eventObservable: true,
event: 'native.keyboardshow', event: 'native.keyboardshow',
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows'] platforms: ['iOS', 'Android']
}) })
onKeyboardShow(): Observable<any> { onKeyboardShow(): Observable<any> {
return; return;
} }
/**
* Creates an observable that notifies you when the keyboard will show. Unsubscribe to observable to cancel event watch.
* @returns {Observable<any>}
*/
@Cordova({
eventObservable: true,
event: 'keyboardWillShow',
platforms: ['iOS', 'Android']
})
onKeyboardWillShow(): Observable<any> {
return;
}
/** /**
* Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch. * Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch.
* @returns {Observable<any>} * @returns {Observable<any>}
@ -87,9 +99,22 @@ export class Keyboard extends IonicNativePlugin {
@Cordova({ @Cordova({
eventObservable: true, eventObservable: true,
event: 'native.keyboardhide', event: 'native.keyboardhide',
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows'] platforms: ['iOS', 'Android']
}) })
onKeyboardHide(): Observable<any> { onKeyboardHide(): Observable<any> {
return; return;
} }
/**
* Creates an observable that notifies you when the keyboard will hide. Unsubscribe to observable to cancel event watch.
* @returns {Observable<any>}
*/
@Cordova({
eventObservable: true,
event: 'keyboardWillHide',
platforms: ['iOS', 'Android']
})
onKeyboardWillHide(): Observable<any> {
return;
}
} }