Skip to content

Commit

Permalink
fix(keyboard): use cordova-plugin-ionic-keyboard (#2743)
Browse files Browse the repository at this point in the history
Previous was using the deprecated keyboard plugin.

Fixes #2306
  • Loading branch information
kensodemann authored and danielsogl committed Sep 25, 2018
1 parent cbeb413 commit fbf7463
Showing 1 changed file with 44 additions and 19 deletions.
63 changes: 44 additions & 19 deletions src/@ionic-native/plugins/keyboard/index.ts
Expand Up @@ -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
Expand All @@ -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 {
Expand All @@ -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.
Expand All @@ -74,22 +73,48 @@ 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>}
*/
@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;
}
}

0 comments on commit fbf7463

Please sign in to comment.