Repository navigation
Preserve Android Modal layout flags when syncing system UI - #60257
Open
fairysword wants to merge 1 commit into
Open
fairysword wants to merge 1 commit into
fairysword wants to merge 1 commit into
Conversation
This was referenced Nov 24, 2026
Visual regressionNo visual differences at ios: no capture |
This branch has not been deployed
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.
Summary:
On API 30 and below,
ReactModalHostView.updateSystemAppearance()synchronizes the Dialog with the Activity by assigning the Activity'sdecorView.systemUiVisibilityto the Dialog's. Besides appearance and visibility flags, that value containsSYSTEM_UI_FLAG_LAYOUT_STABLE,SYSTEM_UI_FLAG_LAYOUT_FULLSCREENandSYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, whichWindowCompat.setDecorFitsSystemWindowsuses below API 30 to implement edge-to-edge. Right aftershow(), the Dialog's layout therefore follows the Activity's configuration instead of the Modal's props:statusBarTranslucent, shown over an Activity that sets these flags itself (for example throughWindowCompatwithout the React Native edge-to-edge flag), inherits them and its content extends behind the opaque navigation bar.The Modal's own flags come back the next time
showOrUpdate()callsupdateProperties(). In practice, that is theonHostResume()thatReactContext.addLifecycleEventListenerposts when the host view attaches while the app is resumed. The steady state is therefore correct, but right after the Modal opens its content is briefly laid out with the wrong bounds.This change keeps the three layout flags from the Dialog's current value and still copies every other flag from the Activity, so the status bar and navigation bar appearance and visibility keep following the Activity as before.
On its own, this change is not visible in the first case, because the initial Modal size currently excludes both bars anyway, so the transient size matches it. It becomes visible together with #60258, which computes the correct initial size: without this change, the root goes
780 → 704 → 780 dpon API 28 with both bars translucent.Changelog:
[ANDROID] [FIXED] - Keep a Modal's own edge-to-edge layout flags when syncing system bar appearance from the Activity on API 30 and below
Test Plan:
Unit tests
ReactModalHostViewTestrunsupdateSystemAppearance()on API 28 and 30 and checks that:Physical device
Venus e5, API 28, both bars translucent, Activity not edge-to-edge. Root heights in dp from
onLayout:The second case in the summary follows from the same code path and was not recorded on a device.
Video
Left to right: before, with #60258 only, and with both changes. Same device and static content, entrance animation disabled in all three builds, clips aligned to the first frame of the backdrop and slowed uniformly to 0.1×. In the right-hand clip, the top edge of the sheet does not move after it appears.
api28-venus-both-bars-translucent-3way.mp4