-
Notifications
You must be signed in to change notification settings - Fork 24.6k
[Android] [adjustResize] Keyboard pushes absolute-positioned dynamic-height component off screen #6785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I just ran into the same problem. My entire view gets pushed off top when the keyboard pops up. making coding really hard since any keyboard-showing-code I may throw at the application suddenly gets interrupted by the entire view being pushed. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I'm experiencing this too. Android only, and only when the selected text input WOULD BE obscured by the keyboard. If I select an input that would remain visible after the keyboard appearance, this does not occur. |
As a quick fix for this, setting the height on the parent <View onLayout={(event) => {
var {height} = event.nativeEvent.layout;
this.setState({height})
}}
style={{flex: 1, height: this.state.height}}>
<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> |
Setting |
I think |
but |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
4 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
|
Please use reaction instead of "+1" comment, adding noise won't help this issue. |
I found the solution of @jveldboom to be the only one that actually works. mind you it should be minHeight and not height...otherwise flex will win. |
Adding this line of code in the manifest file for the activity you want to apply. |
I followed the solution from @maxfadeev and it works! I don't know if the contributes anything to this bug but if it's hidden, the view will be moved upwards |
@jarvisluong, good to see that my comment helped you! |
I have like tried soooo many solutions and NOTHING WORKS!! NOTHING!. |
use your view Wrap with KeboardAvoidingView like:-
And use below code on react native Activity in AndroidManifest.xml Work For me ... |
Using |
Setting full device height to absolute layout works fine for me |
@iamshadmirza use this library if you want to control your view when keyboard open in android and ios both platforms |
This issue looks very similar (if not identical) to #13000, which is closed as 'un-actionable' because the root cause is an underlying Android system issue. There appear to be several workarounds in the issue comments above, which allow you to solve this case. The separate issue about the KeyboardAvoidingView not working with 'adjustPan' should be posted as a standalone issue, if that is still the case. The reproduction posted by the OP (after fixing the syntax) does not reproduce the issue on recent Android emulator (Android 9) with RN 0.59.1. I'm closing this for now, if you disagree, please help us out with an easy to setup (in a repository) reproduction. |
|
This worked for me. Thanks 💯 |
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. after this pls run your project again |
I have used this below library but scrollview gets stuck when the keyboard appears. and my project is an undetached Expo project. |
hi, dude, I don't use this library |
still same issue on iOS, when keyboard shows up it resize the main container and pushes the views up :(...... thats so frustrated |
On Android it's impossible to cover all scenarios. Either there is a problem with empty spacing above the keyboard, if I fix this by "adjustNothing" in android manifest, the KeyboardAvoidingView is completely dead. |
I created a ticket related to the ExNavigator here expo/ex-navigator#105
However I believe this is a core issue.
Currently I am using RN 0.22.2 (on Android)
Basically this is my 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.
The text was updated successfully, but these errors were encountered: