So I had a work around myself that may or may not work for everyone, but I figured I could post this to hopefully help someone who comes across this!
I found a lot of answers but none really helped me. So in my AndroidManinfest.xml
file I set android:windowSoftInputMode="adjustPan|stateHidden"
. Yes, this will still cover the content below the keyboard when it's opened.
To avoid that, I gave all of my scroll views that would be affected by the keyboard being shown a class of inputScrollContainer. Name them whatever you would like.
Since every container (for me) was the same height as was the top bar for each page, I did the following: (you will have to install the device plugin and the keyboard plugin from cordova
- Got window.innerHeight at the beginning of my js (if you do this inside of your
native.keyboardshow
function, iOS will give you the resized view based on the keyboard's height)
Then, inside my native.keyboardShow
function, I did the following:
- Then got the height of the top bar (I chose one as they were all the same)
- Added the added the keyboard height
and top bar height
together
- Then I subtracted those from the window height
Doing this now gave me the height "leftover" for the scroll view to have. After that I:
- Got all elements by class name
inputScrollContainer
- Looped through them and assigned the new height to each (you can assign it to the only scroll view currently in view, but I only had three affected views so I wasn't worried about it)
Now the scroll view was resized to whatever was left between the top bar and the keyboard. Then on my native.keyboardhide
function, I just restored the height to what the original height for all of the scroll views was before.
I'm sure there are other ways to do this, but doing it this way gave me flexibility and consistency across iOS and Android. I hope this helps someone!