Skip to content
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

[v4][v5] [Android] | TextInput at the bottom of a scroll view falls behind keyboard #1934

Open
atlj opened this issue Sep 12, 2024 · 10 comments
Assignees
Labels
bug Something isn't working v5

Comments

@atlj
Copy link

atlj commented Sep 12, 2024

Bug

I was able to reproduce this both with 4.6.4 and 5-alpha.11. When I have a scroll view and there is a text input at the bottom, the text input falls behind the keyboard on Android. I'm using the android_keyboardInputMode="adjustResize" and my snap point here is 100%.

Screen.Recording.2024-09-12.at.14.57.31.mov

Environment info

Library Version
@gorhom/bottom-sheet 4.6.4
react-native 0.74.1
react-native-reanimated 3.10.1
react-native-gesture-handler 2.16.1

Steps To Reproduce

  1. Create a bottom sheet with a long scrollable content
  2. Place a text input at the bottom
  3. Set android_keyboardInputMode="adjustResize" (also change this option in your app.json/AndroidManifest.xml to adjustResize
  4. Set your snap point as 100%
  5. Scroll to the bottom
  6. Click on the text input on Android

Describe what you expected to happen:

  1. The text input should still be visible when the keyboard is enabled

What's happening instead:

  1. The text input falls behind the keyboard ~70% of the time

Reproducible sample code

https://snack.expo.dev/@atlj0/bottom-sheet-v4-android-keyboard-hides-textinput

@atlj atlj added the bug Something isn't working label Sep 12, 2024
@brentforder
Copy link

@atlj Try it with this library's BottomSheetTextInput instead of TextInput. I was also experiencing a similar issue with the virtual keyboard until I switched to BottomSheetTextInput.

@atlj
Copy link
Author

atlj commented Sep 14, 2024

Hey @brentforder oh you're right. I actually had this issue with the library's text input too but looks like I used a regular text input on the sample code. I will update it, thanks!

@atlj
Copy link
Author

atlj commented Sep 16, 2024

Okay, I just updated the Snack code, the issue still exists on Android.

@ChristopherGabba
Copy link

+1 on this issue. I have a TextInput that is on a view behind the bottom sheet. When the bottom sheet comes up, it covers the text input. I am just using a regular TextInput because you can't use a BottomSheetTextInput outside of a BottomSheet. I have changed every property of android_keyboardInputMode and keyboardBehavior and nothing changes.

@syntaxSizer
Copy link

+1... i spent hours debugging why my form UI started misbehaving and this is exactly the behavior, i am using bottom-sheet as well, the screen is within bottom sheet provider

@gorhom gorhom self-assigned this Oct 2, 2024
@gorhom gorhom added the v5 label Oct 2, 2024
@gorhom
Copy link
Owner

gorhom commented Oct 2, 2024

thanks @atlj for reporting this issue, the issue is a bit complex especially with how android deal with resizing the whole container but i managed to get it working

Screen.Recording.2024-10-03.at.00.54.50.mp4

im going to test out other use cases before i push the fix

@ChristopherGabba
Copy link

ChristopherGabba commented Oct 3, 2024

@gorhom is there a way to just make android not move the bottom sheet up at all?

I think that's my issue. The keyboard moves up the entire bottom sheet over my text field. I just want my bottom sheet to stay exactly where it's at when the keyboard come up.

Let's say my bottom sheet is at a 50% snap point and in the background screen I have a text input in the upper half. When I tap that text input, the keyboard pushes the entire bottom sheet over my text input on Android only.

@gorhom
Copy link
Owner

gorhom commented Oct 3, 2024

@ChristopherGabba The logic needs to anchor to a certain position after the keyboard appearance and in my fix, it will anchor to the text input.

Wouldn't this address your use case ?

@ChristopherGabba
Copy link

Maybe so, once you push your fix, I'll try it and if it's still an issue, I'll make a repro and submit another issue! Thanks for the work on this, really appreciate it...

@ChristopherGabba
Copy link

ChristopherGabba commented Oct 14, 2024

@gorhom Good afternoon, I tried v5.0.1 and it still appears to be happening. Here is a demo in expo-snack (latest I could go was 5.0.0-alpha but it is still happening in 5.0.1 in my app):

https://snack.expo.dev/@christophergabba/bottom-sheet---issue-reproduction-template

I used a Google Pixel 5. This is a super simplified example, but this is happening in my production app on Android only.

Steps to reproduce:

  1. Tap either dummy button labeled Open Bottom Sheet
  2. After the bottom sheet opens, focus the TextInput by tapping on it

You'll see the bottom sheet shifts up some when the keyboard comes out, resulting in it slightly covering the TextInput. On iOS this is not an issue at all, but on Android it covers the text input. My goal is the bottom sheet should stay completely static right where it is behind the keyboard and shouldn't shift up at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v5
Projects
None yet
Development

No branches or pull requests

5 participants