# Ionic Keyboard Information Update

**URL:** <https://forum.ionicframework.com/t/ionic-keyboard-information-update/124771>\
**Category:** ionic-v3\
**Created:** [March 15, 2018, 8:28pm UTC](https://forum.ionicframework.com/t/ionic-keyboard-information-update/124771 "2018-03-15T20:28:42Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![meatloaf4](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/meatloaf4/32/107396_2.png) [@meatloaf4](https://forum.ionicframework.com/u/meatloaf4)\
**Post date:** [March 15, 2018, 8:28pm UTC](https://forum.ionicframework.com/t/ionic-keyboard-information-update/124771/1 "2018-03-15T20:28:42Z")

</div>

Hey guys just had a chat with @mhartington on the ionic slack channel about **ionic keyboard** and wanted to share with you all what was discussed because I thought it might be helpful.

If you’re have trouble getting the keyboard api to work ensure that the following is true in your project.

1.`ionic-plugin-keyboard` is removed using `ionic cordova plugin rm ionic-plugin-keyboard` ( [why?](https://github.com/ionic-team/ionic-plugin-keyboard) )  
2. `cordova-plugin-ionic-keyboard` is added using `ionic cordova plugin add cordova-plugin-ionic-keyboard`  
3. **You are using the keyboard api docs [here](https://github.com/ionic-team/cordova-plugin-ionic-keyboard#events)**, not the docs [here](https://ionicframework.com/docs/api/platform/Keyboard/) ( these ones are outdated according @mhartington )

* * *

**Update**

Currently documentation states that keyboard close on all platforms is done with `Keyboard.hide()`, **this is only the case for iOS**. For Android use `Keyboard.close()` until pull request is merged.

Hopefully this helps someone!

**Update 2**

There has been some questions about how to access the keyboard events and methods below. The code below is how I’ve been utilizing the keyboard methods and events.

```auto
//Accessing Methods Example
(<any>window).Keyboard.show();
(<any>window).Keyboard.hide();

//Accessing Events Example
window.addEventListener("keyboardWillShow",() => {
    console.log("Keyboard open!");
});
window.addEventListener("keyboardWillHide",() => {
    console.log("Keyboard closed!");
});

```

---

<div class="post-metadata">

**Author:** ![tommm](https://avatars.discourse-cdn.com/v4/letter/t/f6c823/32.png) [@tommm](https://forum.ionicframework.com/u/tommm)\
**Post date:** [March 19, 2018, 7:04am UTC](https://forum.ionicframework.com/t/ionic-keyboard-information-update/124771/2 "2018-03-19T07:04:05Z")

</div>

@meatloaf4 Hoping you could help me out with this…

So I visit the current docs so I can use `Keyboard` in my project. I do some fishing around see the Ionic native plugin is deprecated, and then I find your post here.

I’m obviously not keen on using Ionic’s deprecated `ionic-plugin-keyboard` plugin. Their own github page recommends using `cordova-plugin-ionic-keyboard`, yet this isn’t compatible with `@ionic-native/keyboard`. I don’t understand why they’ve deprecated their plugin without even adding support for the one they’re switching to 😕

If I try to use `@ionic-native/keyboard` with `cordova-plugin-ionic-keyboard` I get:

```auto
console.warn: Native: tried calling Keyboard.show, but the Keyboard plugin is not installed. 
console.warn: Install the Keyboard plugin: 'ionic cordova plugin add ionic-plugin-keyboard' 

```

How do I use the `cordova-plugin-ionic-keyboard` without `@ionic-native/keyboard`? Have I got to [go through these hoops](https://forum.ionicframework.com/t/how-use-a-cordova-plugin-that-not-are-in-the-ionic-native-list-of-plugins-non-native/108413) just to access the darn keyboard?

I’m new to Ionic, Angular, and Cordova… and these issues are stupidly hard to keep on top of.

Thanks for any help!

---

<div class="post-metadata">

**Author:** ![reedrichards](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@reedrichards](https://forum.ionicframework.com/u/reedrichards)\
**Post date:** [March 19, 2018, 8:04am UTC](https://forum.ionicframework.com/t/ionic-keyboard-information-update/124771/3 "2018-03-19T08:04:36Z")

</div>

As far as I understood, right now, `@ionic-native/keyboard` is not really compatible straight forward with the new plugin `cordova-plugin-ionic-keyboard` , you could have a look to this issue [https://github.com/ionic-team/ionic-native/issues/2306](https://github.com/ionic-team/ionic-native/issues/2306)

BUT, the new plugin `cordova-plugin-ionic-keyboard` really improves the quality I think or at least in my case. With `ionic-plugin-keyboard` I was using the wrapper because I still had to handle close/show actions of the keyboard because sometimes it didn’t worked aka the keyboard sometimes used to stayed open. With the new plugin I just don’t have too, it works like a charm, so now in my productive app I just don’t need `@ionic-native/keyboard` anymore.

So depending of the reason why you would need the native wrapper, specially if you need it to close the keyboard, I would suggest first to try without because the new plugin works fine 😉

---

<div class="post-metadata">

**Author:** ![tommm](https://avatars.discourse-cdn.com/v4/letter/t/f6c823/32.png) [@tommm](https://forum.ionicframework.com/u/tommm)\
**Post date:** [March 19, 2018, 9:05am UTC](https://forum.ionicframework.com/t/ionic-keyboard-information-update/124771/4 "2018-03-19T09:05:59Z")

</div>

I’m just after some of the basic show/hide events.

How are you accessing the plugin, `window.keyboard`? This all just seems like such a hack to me, Ionic devs need to get their s\*\*t together…

---

<div class="post-metadata">

**Author:** ![reedrichards](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@reedrichards](https://forum.ionicframework.com/u/reedrichards)\
**Post date:** [March 19, 2018, 9:27am UTC](https://forum.ionicframework.com/t/ionic-keyboard-information-update/124771/5 "2018-03-19T09:27:32Z")

</div>

Like I said, I don’t have anymore, for me show/hide just work fine straight forward now which is a cool improvement

About `window.keyboard` just like described in the doc. And if typescript complains, maybe trying to declare the variable for now on as `any` or write your own typescript file…didn’t tried just a guess

---

<div class="post-metadata">

**Author:** ![tommm](https://avatars.discourse-cdn.com/v4/letter/t/f6c823/32.png) [@tommm](https://forum.ionicframework.com/u/tommm)\
**Post date:** [March 19, 2018, 9:41am UTC](https://forum.ionicframework.com/t/ionic-keyboard-information-update/124771/6 "2018-03-19T09:41:16Z")

</div>

The docs there only explain direct use of the `Keyboard` object. I still can’t figure out how to access it in my components. I’ve tried declaring it above my class, accessing it through `window.plugins.keyboard`, `window.keyboard`, `window.cordova.plugins.keyboard` etc., with no luck.

How are you accessing the `Keyboard` object?

---

<div class="post-metadata">

**Author:** ![tommm](https://avatars.discourse-cdn.com/v4/letter/t/f6c823/32.png) [@tommm](https://forum.ionicframework.com/u/tommm)\
**Post date:** [March 19, 2018, 9:58am UTC](https://forum.ionicframework.com/t/ionic-keyboard-information-update/124771/7 "2018-03-19T09:58:18Z")

</div>

Okay, i’m using this to handle events if it helps anyone…

```auto
Observable.fromEvent( window, 'keyboardWillShow' ).subscribe(e => {
	this.keyboardVisible = true;
	console.log( 'keyboard will open!' );
});

Observable.fromEvent( window, 'keyboardWillHide' ).subscribe(e => {
	this.keyboardVisible = false;
	console.log( 'keyboard will close!' );
});

```

But I still can’t get access `Keyboard`.

---

<div class="post-metadata">

**Author:** ![reedrichards](https://avatars.discourse-cdn.com/v4/letter/r/34f0e0/32.png) [@reedrichards](https://forum.ionicframework.com/u/reedrichards)\
**Post date:** [March 19, 2018, 10:17am UTC](https://forum.ionicframework.com/t/ionic-keyboard-information-update/124771/8 "2018-03-19T10:17:25Z")

</div>

> [@tommm](#):
>
> How are you accessing the Keyboard object?

Again I don’t 😉

Have you try declaring it as `any`? Maybe that’s enough?

```
declare var Keyboard: any;

@IonicPage()
export class...

```

---

<div class="post-metadata">

**Author:** ![tommm](https://avatars.discourse-cdn.com/v4/letter/t/f6c823/32.png) [@tommm](https://forum.ionicframework.com/u/tommm)\
**Post date:** [March 19, 2018, 10:50am UTC](https://forum.ionicframework.com/t/ionic-keyboard-information-update/124771/9 "2018-03-19T10:50:24Z")

</div>

Haha oh.

I think i’ll give up and just use the events for now until Ionic release a working native plugin wrapper.

Thanks anyway 🙂

---

<div class="post-metadata">

**Author:** ![meatloaf4](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/meatloaf4/32/107396_2.png) [@meatloaf4](https://forum.ionicframework.com/u/meatloaf4)\
**Post date:** [March 19, 2018, 9:47pm UTC](https://forum.ionicframework.com/t/ionic-keyboard-information-update/124771/10 "2018-03-19T21:47:57Z")

</div>

I’ll update the main post with how you go about accessing show and hide as well as the events.

---

<div class="post-metadata">

**Author:** ![tommm](https://avatars.discourse-cdn.com/v4/letter/t/f6c823/32.png) [@tommm](https://forum.ionicframework.com/u/tommm)\
**Post date:** [March 21, 2018, 5:14am UTC](https://forum.ionicframework.com/t/ionic-keyboard-information-update/124771/11 "2018-03-21T05:14:44Z")

</div>

Dismissing the keyboard when `KeyboardResize` is set to false requires two taps, anyone else experiencing this.

@mhartington Why is the Issue tracker for the forked branch disabled?

---

<div class="post-metadata">

**Author:** ![diarcastro](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/diarcastro/32/114964_2.png) [@diarcastro](https://forum.ionicframework.com/u/diarcastro)\
**Post date:** [March 22, 2018, 8:58pm UTC](https://forum.ionicframework.com/t/ionic-keyboard-information-update/124771/12 "2018-03-22T20:58:55Z")

</div>

I have made a provider to handler the new plugin properties, events and methods.  
I hope this help you!

> <https://gist.github.com/diarcastro/7f092622004a9d56c10cf2d48d05f78d>

---

<div class="post-metadata">

**Author:** ![ipsjolly](https://avatars.discourse-cdn.com/v4/letter/i/5f9b8f/32.png) [@ipsjolly](https://forum.ionicframework.com/u/ipsjolly)\
**Post date:** [August 12, 2019, 6:10am UTC](https://forum.ionicframework.com/t/ionic-keyboard-information-update/124771/13 "2019-08-12T06:10:58Z")

</div>

For **Ionic 4 Tutorial on Keyboard Native Plugin and Event, listeners** check this [link](https://www.freakyjolly.com/ionic-4-keyboard-native-plugin-tutorial/)

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:44pm UTC](https://forum.ionicframework.com/t/ionic-keyboard-information-update/124771/14 "2021-07-19T21:44:42Z")

</div>

Closed on July 19, 2021, 9:44pm UTC


