ionic-team / cordova-plugin-ionic-keyboard

Keyboard Plugin for Cordova
Other
193 stars 178 forks source link

keyboard opens while still executing keyboardWillShow handler #51

Closed sertal70 closed 5 years ago

sertal70 commented 5 years ago

Normally the ion-footer is pushed up with the keyboard when this is opened, so I added logic in the keyboardWillShow for that pages of my ionic app where I don't want to show the footer when the keyboard is open.

My code is as simple as:

    this.subscrKeyboardShow = this.keyboard.onKeyboardWillShow().subscribe( () => {
      this.showFooter = false;
      this.content.resize();
    });

where the page template is:

     <ion-footer *ngIf='showFooter'>
      ....
     </ion-footer>

anyway I observed that when the keyboard is opened, a blank space as height as the footer is shown over the keyboard, so I set a breakpoint in my handler to inspect what's going on.

When debugger stopped on that line I supposed that the keyboard should not be displayed until I would let the program continue to run, but instead the keyboard suddenly opened.

IMHO the handler should be entirely executed before the keyboard is displayed on the screen, as the name of the handler suggests. Why this is not working in that way?

mmcossu commented 5 years ago

i agree. the same thing happens for the keyboardWillHide event. i'm having a hard time fixing an issue related to these events. i can't simply go to the client and say "it's not supported".

jcesarmobile commented 5 years ago

This is not really a plugin issue, if you debug in Safari you are only inspecting the javascript, but the keyboard events come from the native code, so you should debug in Xcode.

Anyway, they are different native events and they are triggered by the OS, didShow won't wait for willShow to finish, they are different events that just tell you the keyboard is going to show and that the keyboard has been shown, but you can't pause it, nor delay.