-
-
Notifications
You must be signed in to change notification settings - Fork 588
fix(Android, Stack): Moving formsheet above keyboard #3248
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
base: main
Are you sure you want to change the base?
Conversation
39c6b3e
to
bda8134
Compare
Moving back to draft for a while, because I noticed some issues with autofocus and textinput below API 30 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had already started the review before you moved the PR to draft so I'll finish it.
This looks great! I have some remarks/questions:
- Just to be sure, this is not a regression, right? (not respecting navigation bar insets)
Screen_recording_20250929_140451.mp4
- Do you think we can do something about the gap between keyboard and formsheet when they're both hiding at the same time? Should we create a ticket to investigate it in the future?
Screen_recording_20250929_135928.mp4
- We should probably revisit #2925 to fix this, right?
Screen_recording_20250929_140440.mp4
android/src/main/java/com/swmansion/rnscreens/bottomsheet/SheetDelegate.kt
Outdated
Show resolved
Hide resolved
@kligarski answering your questions:
![]()
|
I'm not sure if we're talking about the same thing: I meant the text input being placed behind navigation bar (3-button navigation at the bottom) in first ![]() |
Sorry, I read all together before answering and idk why I started thinking that 1 and 3 are connected. Good that we have an alignment on this one, but we should rethink whether this is expected now |
Description
This PR improves the way the BottomSheet on Android handles the on-screen keyboard (IME). Previously, the keyboard was not respected properly - opening the keyboard could cause content to be partially or fully obscured due to incorrect handling of insets.
With this update:
There are two key touchpoints where we react to IME inset changes:
onProgress
callback: This listens to dynamic IME inset changes outside of enter/exit animations — e.g. when the keyboard resizes or changes without the BottomSheet visibility changing.Priority is given to the animation layer for transforming the component's position, while the onProgress callback serves as a fallback when animations are not active. This prioritization enables us to maintain a smooth and consistent visual appearance across all lifecycle scenarios of the BottomSheet.
Fixes: #3181
Changes
KeyboardDidHide
state forfitToContents
onProgress
callback from insets listener.Screenshots / GIFs
Here you can add screenshots / GIFs documenting your change.
You can add before / after section if you're changing some behavior.
Before
test3248-main.mov
After
test3248.mov
Test code and steps to reproduce
Tested on android with
Test3248
Tested with API levels 29 or higher, because I noticed another issue regarding bottom sheets on 28: https://github.com/software-mansion/react-native-screens-labs/issues/480
Checklist