Hi,
In the Ionic Docs I can see that we’d have use ionic-plugin-keyboard (with the corresponding npm package), but on the gitHub page of that plugin it says that the plugin is deprecated and we’d have to use cordova-plugin-ionic-keyboard. Also on the gitHub page I see we can use some methods. But how can I access those in code? What do I have to import so I’d be able to use those methods in my code? Cann’t find anything about that in the docs…
question still standing…
you can use them like this:
import { Keyboard } from '@ionic-native/keyboard';
and in constructor:
public keyboard: Keyboard,
this.keyboard.onKeyboardShow().subscribe(() => {
doSomething();
});
I tried to use the @ionic-native/keyboard but as far as I can see the methods aren’t matching.
The ionic-plugin-keyboard is different then cordova-plugin-ionic-keyboard.
I’m using cordova-plugin-ionic-keyboard because at the github page of ionic-plugin-keyboard it says that the plugin is deprecated and there is written to use the cordova-plugin-ionic-keyboard.
That’s why I’m a bit confused… Which one are you using?
"ionic-plugin-keyboard": "~2.2.1",
Okay thank you…
Can someone please explain why it says (on the github page) that the plugin ionic-plugin-keyboard is deprecated and we should use cordova-plugin-ionic-keyboard instead??
Verry confusing…
Because it’s been deprecated.
But you can still use it, and its fine.
I can see that yes but what I actually meant was:
In the current Ionic docs the https://ionicframework.com/docs/native/keyboard/ refers to ionic-plugin-keyboard. BUTT, the ionic-plugin-keyboard github repo https://github.com/ionic-team/ionic-plugin-keyboard says it is deprecated. Why is the plugin deprecated on the github page and why is the Ionic Docs refererring to that deprecated plugin.?
The main docs are always behind. Take the Ionic docs as a good first step, and then read the docs of whatever specific piece you’re interested in.
Okay, good to know. Will work that way then…
One final (off-topic) related question. Is there a way to check (without the onKeyboardShow/Hide) if the keyboard is open?
(( e.g. in cordova-plugin-ionic-keyboard there’s a property called Keyboard.isVisible ))
probably not because this is useless and replaceable in most scenarios
Okay, that’ll do it then…
Thanks for your help and time.