Skip to content

SwiftUI-based filter content collapses after Fabric view recycling on iOS #57642

Description

@lujjjh

Description

With SwiftUI-based filters enabled, Fabric view recycling can collapse the content inside RCTSwiftUIContainerView.

The outer RCTViewComponentView and _UIHostingView retain their expected height, but the internal SwiftUI hierarchy becomes zero-height.

As a result, the React Native child still has the correct frame but is invisible because its SwiftUI wrapper has zero height.

I reproduced this consistently on the two iOS versions I tested: iOS 16.0 and iOS 26.5. Disabling safe-area handling for the hosting controller fixed the issue on both versions.

If this fix makes sense, I’m happy to submit a PR.

Tested on React Native main at commit ad870da.

Steps to reproduce

  1. Clone the reproducer:
    https://github.com/lujjjh/react-native-swiftui-filter-repro/tree/repro/ios-swiftui-filter-recycle
  2. Install dependencies and prepare RNTester for iOS.
  3. Build and launch RNTester.
  4. Open the Playground tab.
  5. Wait approximately 1.5 seconds.

Expected:
The orange content fills the purple 28×28 outline.

Actual:
Only the purple outline is visible because the internal SwiftUI wrapper has zero height.

React Native Version

0.87.0

Affected Platforms

Runtime - iOS, Build - MacOS

Output of npx @react-native-community/cli info

System:
  OS: macOS 26.5.2
  CPU: (18) arm64 Apple M5 Pro
Binaries:
  Node: 26.5.0
  Yarn: 1.22.22
  npm: 11.17.0
Managers:
  CocoaPods: 1.16.2
SDKs:
  iOS SDK: 26.5
IDEs:
  Xcode: 26.6/17F113
Languages:
  Ruby: 2.6.10

Stacktrace or Logs

There is no crash or JavaScript error.

RCTViewComponentView                         28
_UIHostingView<SwiftUIContainerView>         28
_UIInheritedView                              0
PlatformViewHost<UIViewWrapper>               0
UIView wrapper                                0
RCTViewComponentView child                   28

MANDATORY Reproducer

https://github.com/lujjjh/react-native-swiftui-filter-repro/tree/repro/ios-swiftui-filter-recycle

Screenshots and Videos

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions