Skip to content

Commit 1457a16

Browse files
kensodemanndanielsogl
authored andcommitted
fix(keyboard): use cordova-plugin-ionic-keyboard (#2743)
Previous was using the deprecated keyboard plugin. Fixes #2306
1 parent bfd46ee commit 1457a16

File tree

1 file changed

+44
-19
lines changed
  • src/@ionic-native/plugins/keyboard

1 file changed

+44
-19
lines changed

src/@ionic-native/plugins/keyboard/index.ts

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { Observable } from 'rxjs/Observable';
77
* @description
88
* Keyboard plugin for Cordova.
99
*
10-
* Requires Cordova plugin: `ionic-plugin-keyboard`. For more info, please see the [Keyboard plugin docs](https://github.com/ionic-team/ionic-plugin-keyboard).
10+
* 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).
1111
*
1212
* @usage
1313
* ```typescript
@@ -19,16 +19,16 @@ import { Observable } from 'rxjs/Observable';
1919
*
2020
* this.keyboard.show();
2121
*
22-
* this.keyboard.close();
22+
* this.keyboard.hide();
2323
*
2424
* ```
2525
*/
2626
@Plugin({
2727
pluginName: 'Keyboard',
28-
plugin: 'ionic-plugin-keyboard',
29-
pluginRef: 'cordova.plugins.Keyboard',
30-
repo: 'https://github.com/ionic-team/ionic-plugin-keyboard',
31-
platforms: ['Android', 'BlackBerry 10', 'iOS', 'Windows']
28+
plugin: 'cordova-plugin-ionic-keyboard',
29+
pluginRef: 'window.Keyboard',
30+
repo: 'https://github.com/ionic-team/cordova-plugin-ionic-keyboard',
31+
platforms: ['Android', 'iOS']
3232
})
3333
@Injectable()
3434
export class Keyboard extends IonicNativePlugin {
@@ -37,35 +37,34 @@ export class Keyboard extends IonicNativePlugin {
3737
* @param hide {boolean}
3838
*/
3939
@Cordova({ sync: true })
40-
hideKeyboardAccessoryBar(hide: boolean): void {}
40+
hideFormAccessoryBar(hide: boolean): void {}
4141

4242
/**
43-
* Force keyboard to be shown.
43+
* Hide the keyboard if shown.
4444
*/
4545
@Cordova({
4646
sync: true,
47-
platforms: ['Android', 'BlackBerry 10', 'Windows']
47+
platforms: ['iOS', 'Android']
4848
})
49-
show(): void {}
49+
hide(): void {}
5050

5151
/**
52-
* Close the keyboard if open.
52+
* Force keyboard to be shown.
5353
*/
5454
@Cordova({
5555
sync: true,
56-
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
56+
platforms: ['Android']
5757
})
58-
close(): void {}
58+
show(): void {}
5959

6060
/**
61-
* Prevents the native UIScrollView from moving when an input is focused.
62-
* @param disable {boolean}
61+
* Programatically set the resize mode
6362
*/
6463
@Cordova({
6564
sync: true,
66-
platforms: ['iOS', 'Windows']
65+
platforms: ['iOS']
6766
})
68-
disableScroll(disable: boolean): void {}
67+
setResizeMode(): void {}
6968

7069
/**
7170
* Creates an observable that notifies you when the keyboard is shown. Unsubscribe to observable to cancel event watch.
@@ -74,22 +73,48 @@ export class Keyboard extends IonicNativePlugin {
7473
@Cordova({
7574
eventObservable: true,
7675
event: 'native.keyboardshow',
77-
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
76+
platforms: ['iOS', 'Android']
7877
})
7978
onKeyboardShow(): Observable<any> {
8079
return;
8180
}
8281

82+
/**
83+
* Creates an observable that notifies you when the keyboard will show. Unsubscribe to observable to cancel event watch.
84+
* @returns {Observable<any>}
85+
*/
86+
@Cordova({
87+
eventObservable: true,
88+
event: 'keyboardWillShow',
89+
platforms: ['iOS', 'Android']
90+
})
91+
onKeyboardWillShow(): Observable<any> {
92+
return;
93+
}
94+
8395
/**
8496
* Creates an observable that notifies you when the keyboard is hidden. Unsubscribe to observable to cancel event watch.
8597
* @returns {Observable<any>}
8698
*/
8799
@Cordova({
88100
eventObservable: true,
89101
event: 'native.keyboardhide',
90-
platforms: ['iOS', 'Android', 'BlackBerry 10', 'Windows']
102+
platforms: ['iOS', 'Android']
91103
})
92104
onKeyboardHide(): Observable<any> {
93105
return;
94106
}
107+
108+
/**
109+
* Creates an observable that notifies you when the keyboard will hide. Unsubscribe to observable to cancel event watch.
110+
* @returns {Observable<any>}
111+
*/
112+
@Cordova({
113+
eventObservable: true,
114+
event: 'keyboardWillHide',
115+
platforms: ['iOS', 'Android']
116+
})
117+
onKeyboardWillHide(): Observable<any> {
118+
return;
119+
}
95120
}

0 commit comments

Comments
 (0)