ionic-team / cordova-plugin-ionic-keyboard

Keyboard Plugin for Cordova
Other
191 stars 177 forks source link

Keyboard event onKeyBoardHide() and keyboardDidHide() creates a lag in ios in Ionic v4 #144

Open paamrutk opened 4 years ago

paamrutk commented 4 years ago

We are using ionic keyboard plugin. On closing the keyboard, we are calling

this.keyboard.onKeyboardHide().subscribe(() => { // we are shifting the entire page down to its original position });

When this onKeyboardHide event is triggered, there is a shift down and then our code where we are shifting the page to its original position gets executed. Thus, the page shifts down twice.

Same event when triggered in Android, it works smoothly without any lag.

Can anyone please help us with this.

Ionic Info: Ionic: Ionic CLI : 5.2.7 (/usr/local/lib/node_modules/ionic) Ionic Framework : @ionic/angular 4.10.0 @angular-devkit/build-angular : 0.801.3 @angular-devkit/schematics : 8.1.3 @angular/cli : 8.1.3 @ionic/angular-toolkit : 2.0.0 Cordova: Cordova CLI : 9.0.0 (cordova-lib@9.0.1) Cordova Platforms : android 8.1.0, ios 5.1.1 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-migrate-ios-storage 0.3.6, cordova-plugin-ionic-webview 4.1.2, (and 21 other plugins) Utility: cordova-res : not installed native-run : not installed System: ios-deploy : 1.9.4 ios-sim : 8.0.2 NodeJS : v10.15.1 (/usr/local/bin/node) npm : 6.4.1 OS : macOS Mojave Xcode : Xcode 10.1 Build version 10B61

quangpdt commented 4 years ago

Same here with Ionic 5 version. Nearly 2 months without reply, I guess we have to find our own way on editing native code ourself

PocoMin commented 4 years ago

Use window event instead of the plugin method

fromEvent(window, "keyboardWillShow").subscribe(() => {
      //action here
});

fromEvent(window, "keyboardWillHide").subscribe(() => {
     //action here
});
Thul999 commented 4 years ago

The same is happening to me even when using window event as @PocoMin suggested =(