When working with a NativeScript application view where a user can enter input, the native application Keyboard Input overlays the TextField
component. While this doesn't stop the user from entering text, it disrupts the UX flow and looks bad from a UI perspective.
How can I get the Keyboard to not overlay the input, but instead appear underneath it like other native applications can do?
Update 2
Now that it no longer overlays, I've noticed that when I leave the application to switch to another one or suspend the NativeScript app, when I come back to it the problem reappears. What can I do to persist the original behavior?
After stumbling around a few other discussions and resources:
There were a few takeaways from these resources which I'll review below.
Template Flow
First off, you'll need to ensure your page layout mirrors something like below:
Android Soft Input Mode
This relates to the on-screen keyboard that displays when a text field in the UI receives focus. One trick to ensure the keyboard does not overlay your textfield is to ensure you have the property
windowSoftInputMode
set in yourAndroidManifest.xml
. You can either useadjustResize
oradjustPan
. I'm not entirely sure of the differences, but some users have reported either or both working so you might need to play around with which works for your case. You can read more about these two flags here.Update 2
I believe there is something getting reset within NativeScript which is causing the flag set by
android:windowSoftInputMode
to be reset when the application issuspended
andresumed
. To get around this, you'll need to make some adjustments in the controller of the view itself to watch for these events to happen in your app's lifecycle and then retroactively enable the flags again.some-view.component.ts (TypeScript)
I also had the same issue,
Adding the following didn't work for me
Instead of adding
android:windowSoftInputMode
inapplication
, add it inactivity
, check the following.Also need to update the
style.xml
, add the following inLaunchScreenThemeBase
This will fix the keyboard overlay issue but it will create another issue, causing the Status bar / Action Bar to change height when the keyboard is displayed. to resolve that, put the following in
style.xml
in AppThemeBase (To correct the color of status bar)In _app-common.scss (To get rid of extra space)