In my Cordova app I'd like to be able to tell if a particular element is offscreen, and scroll it to the center of the viewport if it is. Unfortunately, my calculations all seem to be thrown off by the various sizes of the iOS and Android keyboards -- the height varies based on the keyboard used, whether auto-suggestions are on, whether the screen is in portrait or landscape mode, etc.
On iOS, Cordova has the cordova-plugin-keyboard plugin that gives us the height in the KeyboardHeightWillChange event. I see that there is something in native code for Android mentioned in this blog post: https://pspdfkit.com/blog/2016/keyboard-handling-on-android/. Has anyone found a means to determine the height of the keyboard in Cordova-land on both iOS and Android?
As far as i checked, this plugin's - Cordova native keyboard plugin onKeyboardWillShow & onKeyboardDidShow options does what you are expecting.
Unfortunately this plugin is commercial as the author has mentioned that it was a beast to implement. But he is also open for suggestion regarding the costing. You can mail him to check out the options. Cheers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With