Description
In brownfield Android apps using Fabric (New Architecture), formSheet modals are invisible upon presentation. The modal is correctly sized and positioned behind the scenes, but the fragment's postponed enter transition is never started, so it never becomes visible. The user must trigger a re-layout (e.g., lock/unlock the screen) for the modal to appear.
Root cause
The bug was introduced in #3404
In ScreenStackFragment.onCreateView(), for formSheet presentation, BottomSheetTransitionCoordinator waits for both a layout callback and an insets callback before calling startPostponedEnterTransition(). In brownfield apps, the host activity's window insets have already been dispatched before the formSheet's ViewCompat.setOnApplyWindowInsetsListener is attached (because the RN surface is hosted inside a fragment that was added to an already-running activity). This means areInsetsApplied in BottomSheetTransitionCoordinator never becomes true, and the postponed enter transition is permanently stuck.
The pre-layout pass in onCreateView() correctly measures and lays out the coordinatorLayout, giving the screen valid dimensions. But the transition doesn't start because it's waiting for the insets callback that will never come.
Steps to reproduce
- Set up a brownfield Android app with Fabric enabled (New Architecture)
- Host a React Native surface inside a Fragment (e.g., using
ReactSurfaceView in a custom Fragment)
- Navigate to a screen that presents a
formSheet modal
- The modal is invisible — the bottom sheet is sized correctly but the fragment transition never starts
- Lock and unlock the phone — the modal suddenly becomes visible (because the re-layout triggers the transition)
Snack or a link to a repository
https://github.com/lhanindeed/react-native-screens-brownfield-bug-repro
Screens version
4.24.0
React Native version
0.83.2
Platforms
Android
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Fabric (New Architecture)
Build type
Release mode
Device
Real device
Device model
No response
Acknowledgements
Yes
Description
In brownfield Android apps using Fabric (New Architecture),
formSheetmodals are invisible upon presentation. The modal is correctly sized and positioned behind the scenes, but the fragment's postponed enter transition is never started, so it never becomes visible. The user must trigger a re-layout (e.g., lock/unlock the screen) for the modal to appear.Root cause
The bug was introduced in #3404
In
ScreenStackFragment.onCreateView(), for formSheet presentation,BottomSheetTransitionCoordinatorwaits for both a layout callback and an insets callback before callingstartPostponedEnterTransition(). In brownfield apps, the host activity's window insets have already been dispatched before the formSheet'sViewCompat.setOnApplyWindowInsetsListeneris attached (because the RN surface is hosted inside a fragment that was added to an already-running activity). This meansareInsetsAppliedinBottomSheetTransitionCoordinatornever becomestrue, and the postponed enter transition is permanently stuck.The pre-layout pass in
onCreateView()correctly measures and lays out thecoordinatorLayout, giving the screen valid dimensions. But the transition doesn't start because it's waiting for the insets callback that will never come.Steps to reproduce
ReactSurfaceViewin a custom Fragment)formSheetmodalSnack or a link to a repository
https://github.com/lhanindeed/react-native-screens-brownfield-bug-repro
Screens version
4.24.0
React Native version
0.83.2
Platforms
Android
JavaScript runtime
Hermes
Workflow
React Native (without Expo)
Architecture
Fabric (New Architecture)
Build type
Release mode
Device
Real device
Device model
No response
Acknowledgements
Yes