ionic-team / ionic-plugin-keyboard

Ionic Keyboard Plugin for Cordova
Apache License 2.0
610 stars 274 forks source link

Event names native.showkeyboard and native.hidekeyboard not working in Angular2 #230

Open skicson opened 8 years ago

skicson commented 8 years ago

In angular, the syntax to get a window event is something like:

<div id="appbody" (window:resize)="doResize($event)">
</div>

However, replacing "resize" with native.keyboardshow or native.keyboardhide does not work (the callback does not get called). Through trial and error, it appears the '.' in the event name is causing an issue.

If the event names are renamed without the '.', like 'native-keyboardshow' and 'native-keyboardhide', they work as expected.

This may very well be an angular issue; Just noting it for other users....

ghost commented 7 years ago

I'm seeing the same thing happen from time to time in V1. The event only fires about 6/10 times on average for me. It is causing major pain for us.

nikoTM commented 7 years ago

You can use something like this

Observable.fromEvent(window, 'native.keyboardshow')
Observable.fromEvent(window, 'native.keyboardhide')

To create an observable for window event. I don't think those events were meant to be used like that.

Or you could use ionic native Keyboard methods.

import { Keyboard } from 'ionic-native';

// Both return are Observable<any>
Keyboard.onKeyboardShow();
Keyboard.onKeyboardHide();
louisdoe commented 7 years ago

How do it work with ionic 1? Keyboard.onKeyboardShow() doesn't fire...

ghost commented 7 years ago

Are you running the app in full screen mode?

I've found that the events don't fire correctly in full screen mode. On Fri, 17 Mar 2017 at 12:05 PM louisdoe notifications@github.com wrote:

How do it work with ionic 1? Keyboard.onKeyboardShow() doesn't fire...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/driftyco/ionic-plugin-keyboard/issues/230#issuecomment-287314703, or mute the thread https://github.com/notifications/unsubscribe-auth/ANBc47YSLdvaVx6BCxkx4wFZ9jAldm1Dks5rmlrcgaJpZM4Ke5s4 .

louisdoe commented 7 years ago

No I am not running in full screen mode, at least i don't think so. How do i check ?