feat(Android, SAV+Stack): add support for SAV in Stack#3405
Open
feat(Android, SAV+Stack): add support for SAV in Stack#3405
Conversation
t0maboro
approved these changes
Nov 19, 2025
android/src/main/java/com/swmansion/rnscreens/stack/views/ScreensCoordinatorLayout.kt
Outdated
Show resolved
Hide resolved
2 tasks
3 tasks
Contributor
|
@kligarski sorry for the delay. I can confirm that this change fixes the issue in expo. Thank you |
kligarski
commented
Feb 12, 2026
Comment on lines
+377
to
+401
| private fun shouldReadInsetsEarlyFromDecorView(): Boolean { | ||
| if (insetsApplied || | ||
| headerConfig?.isHeaderHidden == true || | ||
| headerConfig?.isHeaderTranslucent == true | ||
| ) { | ||
| return false | ||
| } | ||
|
|
||
| // This is a heuristic - if a screen with non-translucent header is above us, we assume that | ||
| // it will handle the insets. If so, we don't want to read insets from DecorView as they | ||
| // would be accounted for more than once. | ||
| var current = parentAsView() | ||
| while (current != null) { | ||
| if (current is Screen && | ||
| current.headerConfig?.isHeaderHidden == false && | ||
| current.headerConfig?.isHeaderTranslucent == false | ||
| ) { | ||
| return false | ||
| } | ||
| current = current.parentAsView() | ||
| } | ||
|
|
||
| return true | ||
| } | ||
|
|
Contributor
Author
There was a problem hiding this comment.
I had to adjust the workaround from #3442 to handle nested stacks. In theory, we can also check headerConfig.toolbar.{shouldApplyTopInset, shouldAvoidDisplayCutout} but they are hard-coded to true right now.
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
Adds support for SAV in Stack on Android. Fixes handling insets by the header (
CustomToolbar).3405.mp4
Fixes #3398.
Closes https://github.com/software-mansion/react-native-screens-labs/issues/464.
Changes
ScreensCoordinatorLayout'sdispatchApplyWindowInsetsto manage order and flow of inset consumptionscreenInsetsinCustomToolbarto store insets designated for Screen componentmenuViewinCustomToolbarwhen used in nested stackTest3405Test code and steps to reproduce
Run
Test3405.Checklist