Skip to content

[0.81] Fix display: contents nodes not being cloned with the wrong owner #1030

@j-piasecki

Description

@j-piasecki

Target Branch

0.81

Link to commit or PR to be picked

facebook/react-native#52530

Description

Summary:
This PR fixes two issues with display: contents implementation:

  1. When a node with display: contents set is a leaf, it won't be cloned after the initial tree is built. The added test case covers this scenario.
  2. It was possible for the subtree of display: contents nodes not to be cloned during layout. I don't have a minimal reproduction for this one, unfortunately. It was discovered in the Expensify app: [Due for payment 2025-07-28] [$250] [DEV] - iOS HybridApp crashes when opening a workspace expense that misses category Expensify/App#65268, along with a consistent reproduction. In that specific case, it seems to be heavily tied to react-native-onyx, which is a state management library.

Changelog: [GENERAL][FIXED] - Fixed nodes with display: contents set being cloned with the wrong owner

X-link: facebook/yoga#1826

Reviewed By: adityasharat

Differential Revision: D78084270

Pulled By: j-piasecki

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type Pick RequestPick requests to include commits inside a React Native release

    Type

    No type

    Projects

    Status

    Done / Picked

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions