Skip to content

fix(Android, FormSheet): start postponed transition immediately when screen has valid dimensions after pre-layout#4011

Open
lhanindeed wants to merge 1 commit into
software-mansion:mainfrom
lhanindeed:fix/formsheet-brownfield-postponed-transition
Open

fix(Android, FormSheet): start postponed transition immediately when screen has valid dimensions after pre-layout#4011
lhanindeed wants to merge 1 commit into
software-mansion:mainfrom
lhanindeed:fix/formsheet-brownfield-postponed-transition

Conversation

@lhanindeed

Copy link
Copy Markdown

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.setOnApplyWindowInsetsListener is attached. BottomSheetTransitionCoordinator.areInsetsApplied therefore never becomes true and the postponed enter transition is permanently stuck — the sheet is sized correctly but never becomes visible until something
forces 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 main branch demonstrates the invisible-modal behavior and the proposed-fix branch applies this change via patch-package to confirm the modal appears immediately on presentation.

  • Before: formSheet modal is invisible until lock/unlock or rotation forces a re-layout.
  • After: formSheet modal appears immediately on presentation.
  • Greenfield (default RN template): no behavior change.
  • Keyboard interaction: existing insets listener still handles re-layout when keyboard appears/disappears.

Checklist

  • Included code example that can be used to test this change.
  • For visual changes, included screenshots / GIFs / recordings documenting the change.
  • For API changes, updated relevant public types.
  • Ensured that CI passes

…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
@t0maboro

Copy link
Copy Markdown
Contributor

Hi @lhanindeed , thanks for the contribution, I'm adding this PR to my review queue

@t0maboro t0maboro self-requested a review May 11, 2026 13:54
@lhanindeed

Copy link
Copy Markdown
Author

Hi @t0maboro any progress on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

formSheet modal is invisible in brownfield Fabric apps until re-render because postponed enter transition never starts

2 participants