Ionic keyboard onKeyboardShow()

I want to use this observable but I am not sure how to do it.

I currently have this as my code:
this.myKeyboard = Keyboard.onKeyboardShow();

but onKeyboardShow() isn’t reregistering as a function. I’ve imported the library Keyboard and the Observables libraries but not having any luck…any ideas?

video of my issue: https://dl.dropboxusercontent.com/u/10729686/keyboard%20movie.mov

this is the error I get:
ERROR in [default] login.ts:31:35
Property ‘onKeyboardShow’ does not exist on type ‘typeof Keyboard’.

My bigger issue though is that I have a form nested near the bottom of the page - and when you tap into the form. The keyboard opens up and lays on top of the form, instead of pushing the page up.

Thanks!

HI. Did you find any solution to this? I have the same prob

The documentation is not very clear on how to use the keyboard, but I figured it out.

In your .ts file, you need the following:

import { Keyboard } from 'ionic-native';
.
.
.
 Keyboard.onKeyboardShow()
    .subscribe(data => {
       console.log('keyboard is shown');
       //your code goes here
    });

Here is a good article on observables

1 Like

Hello @beetz12

Your code is perfect, it helped me a lot,

but my confusion is where to put this code so that whenever keyboard is opened i can execute my code.

i tried putting it in constructor, but it calls only one time, at start time but that not worked.

can you describe where to put this onKeyboardShow code.

I want to hide tabs whenever keyboard opens up.