fix(Android, FormSheet): Apply workaround for controlling insets on BottomSheetBehavior#3611
Open
fix(Android, FormSheet): Apply workaround for controlling insets on BottomSheetBehavior#3611
Conversation
d73f123 to
4895a18
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a workaround to prevent
BottomSheetBehaviorfrom handling system window insets that interfere with our custom layout logic.By manually controlling
isGestureInsetBottomIgnoredwe're bypassingBottomSheetBehavior'sinternalsetWindowInsetsListener, we eliminate unintended top padding caused by defaultinsetTopcalculations, taking the responsibility for handling it on our side bysheetShouldOverflowTopInset.Using the
sheetShouldOverflowTopInsetprop, we take full control over how the BottomSheet interacts with the system bars, ensuring more control over system insets.Additionally, there was a 2nd issue related to this problem:
expandedOffsetFromTopshouldn't account for the system inset when we're overflowing it. The proper flag for hangling that case for 3 detents was passed to our calculations for expandedOffset.Closes: https://github.com/software-mansion/react-native-screens-labs/issues/926
Changes
isGestureInsetBottomIgnoreddetermined bysheetShouldOverflowTopInsetvalueexpandedOffsetFromTopcalculations inSheetDetentsclassBefore & after - visual documentation
Before.mov
after.mov
Test plan
Added a new TC, regression testing on previously added TC for FormSheets & TestFormSheet.
Checklist