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] [adjustResize] Keyboard pushes absolute-positioned dynamic-height component off screen

See original GitHub issue

I created a ticket related to the ExNavigator here https://github.com/exponentjs/ex-navigator/issues/105

However I believe this is a core issue.

Currently I am using RN 0.22.2 (on Android)

Basically this is my View

<View style={{flex: 1}}>
      <View style={[position: 'absolute', top: 0, left: 0, right: 0, height: 50]}>

      </View>
      <View style={[position: 'absolute', bottom: 0, left: 0, right: 0, height: 50]}>
          <TextInput />
     </View>
<View>

This is basically a chat window with an input field positioned at the bottom of the screen and a header positioned at the top of the screen.

When I first open / run the app, Upon focus of the TextInput, the keyboard appears and the View component positioned at the top is pushed off the page.

I spent a day yesterday figuring out why but in the end I used keyboardDidShow and keyboardDidHide to offset the position of the element so it kind of works.

However today I noticed something different. By chance I minimized the App. I didn’t close it. I opened it back up and now the View component that should be positioned at the top was now in the middle. (My offset was calculated to ~270)

So I once again removed the offset handling changes and positioned it statically at the top with top: 0. I then ran the app again by closing and reopening, as expected the View component was once again pushed off the screen when the keyboard appeared.

I minimized the app, then brought it back up. This time when the keyboard appeared, the View component stayed at the top! This is what I am expecting when you open the app the first time, however it only works after minimizing it first.

Definitely seems like a bug to me.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:43
  • Comments:59 (6 by maintainers)

github_iconTop GitHub Comments

67reactions
marcshillingcommented, Nov 29, 2016

Setting android:windowSoftInputMode="adjustNothing" on the MainActivity in AndroidManifest.xml to completely disable the automatic keyboard resizing was my workaround. I then do all the keyboard resizing/scrolling logic myself.

60reactions
ivanzotovcommented, Aug 9, 2017

android:windowSoftInputMode="adjustPan" works for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android: How do I prevent the soft keyboard from pushing my ...
When the soft keyboard opens, it pushes the tab for the drawer up, so it sits atop the keyboard. I actually want it...
Read more >
Adjustresize Doesn't Work Properly For Numeric Keyboard ...
If you want to test with the soft keyboard be sure to open up the Android ... Keyboard pushes absolutepositioned dynamicheight component off...
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 how to adjust for soft keyboard | by Yat Man, Wong
Notice adjustResize only have effect on layouts that are resizable. Like items in RelativeLayout with weight or page wrapped in ScrollView.
Read more >
How to make your React Native app respond gracefully when ...
Today I'll show you 3 different ways you can avoid the keyboard in React ... By adding android:windowSoftInputMode="adjustResize" to your ...
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