fix(Android, FormSheet): start postponed transition immediately when screen has valid dimensions after pre-layout#4011
Open
lhanindeed wants to merge 1 commit into
Conversation
…screen has valid dimensions after pre-layout In brownfield Fabric apps, the container's window insets are dispatched before the formSheet's insets listener is attached, so BottomSheetTransitionCoordinator.areInsetsApplied never becomes true and the postponed enter transition is permanently stuck. After the pre-layout pass, if the screen already has valid dimensions, start the transition immediately. The existing insets listener still handles re-layout for dynamic changes (e.g. keyboard). Closes software-mansion#4010
Contributor
|
Hi @lhanindeed , thanks for the contribution, I'm adding this PR to my review queue |
Author
|
Hi @t0maboro any progress on this? |
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
Fixes #4010 — formSheet modals are invisible on presentation in brownfield Android apps on Fabric.
In brownfield apps, the host activity's window insets are dispatched before the formSheet's
ViewCompat.setOnApplyWindowInsetsListeneris attached.BottomSheetTransitionCoordinator.areInsetsAppliedtherefore never becomestrueand the postponed enter transition is permanently stuck — the sheet is sized correctly but never becomes visible until somethingforces a re-layout (lock/unlock, rotate, keyboard).
Changes
After the pre-layout pass in
ScreenStackFragment.onCreateView(), if the screen already has valid dimensions, start the postponed enter transition immediately instead of waiting for the insets callback that will never fire.In greenfield apps the existing insets-driven trigger still fires; the postpone mechanism is idempotent so there is no double-trigger.
Test plan
A minimal brownfield Android reproduction (RN 0.83.2, Fabric, react-native-screens 4.24.0) is at https://github.com/lhanindeed/react-native-screens-brownfield-bug-repro — the
mainbranch demonstrates the invisible-modal behavior and theproposed-fixbranch applies this change viapatch-packageto confirm the modal appears immediately on presentation.Checklist