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
* 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 {}
/**
* Hide the keyboard if shown.
*/
@Cordova({
sync: true,
platforms: ['iOS', 'Android']
})
hide(): void {}
/**
* Force keyboard to be shown.
*/
@Cordova({
sync: true,
platforms: ['Android', 'BlackBerry 10', 'Windows']
platforms: ['Android']
})
show(): void {}
/**
* Close the keyboard if open.
* Programatically set the resize mode
*/
@Cordova({
sync: true,
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
platforms: ['iOS']
})
close(): 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 {}
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<any> {
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.
* @returns {Observable<any>}
@ -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<any> {
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;
}
}