question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android: Top inset is changed on keyboard dismissal when windowSoftInputMode = adjustPan

See original GitHub issue

Not sure if this is the expected behavior, but when windowSoftInputMode is set to adjustPan, the top inset changes significantly after opening and dismissing the keyboard, i.e. the top inset can increase from 0 to over 100 after the keyboard is dismissed.

On Android, the adjustPan input mode automatically shifts the screen upward so that focused text inputs are moved above the software keyboard. This input mode is often recommended for handling input/keyboard avoidance on Android due to inconsistent behavior with KeyboardAvoidingView. I assume that when the app screen is shifted back downwards, the top inset value is set to the Y offset value used to pan the view back into its original position.

If this is expected behavior, it seems inconsistent in that the bottom inset doesn’t change when the pan-upwards effect is performed upon opening the keyboard.

In my particular use case, the fact that the adjustPan mode affects insets makes it difficult to rely on the safe area context insets in places that are intended to account only for the presence of notches: I’m using the top inset to add top padding to a navigation bar but the padding value jumps in size after dismissing the keyboard.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:7

github_iconTop GitHub Comments

5reactions
janicduplessiscommented, Feb 5, 2020

Fixed in 0.7.0

1reaction
papigerscommented, Jan 7, 2020

Same issue here. For now using react-native-status-bar-height as @ninjacoder95 suggested.

Read more comments on GitHub >

github_iconTop Results From Across the Web

windowSoftInputMode="adjustResize" not working with ...
Normaly, changing the InputMode to adjustResize , the app should resize itself when keyboard is shown, but here it won't! If I delete...
Read more >
Handle input method visibility | Android Developers
When input focus moves in or out of an editable text field, Android shows or hides the input method—such as the on-screen keyboard—as ......
Read more >
Android keyboard on Surface Duo - Dual-screen
Working with the keyboard on Surface Duo. ... To detect the keyboard inset, first add android:windowSoftInputMode to your Android manifest:.
Read more >
Keyboard handling in Jetpack Compose - DEV Community ‍ ‍
... with no physical keyboard (the vast... Tagged with android, jetpackcompose, kotlin. ... android:windowSoftInputMode="adjustResize".
Read more >
Keyboard Handling In Jetpack Compose — All You Need To ...
Also, we can dismiss a keyboard by removing the focus from the TextField ... In manifest file set adjustResize to windowSoftInputMode attribute.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found