Skip to content

Preserve selective cloning of hidden Yoga children - #60185

Merged
cipolleschi merged 3 commits into
react:mainfrom
cipolleschi:reconcile-yoga-selective-hidden-cloning
Nov 20, 2026
Merged

cipolleschi merged 3 commits into
react:mainfrom
cipolleschi:reconcile-yoga-selective-hidden-cloning

Conversation

@cipolleschi

@cipolleschi cipolleschi commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

Restore the selective display: none child-cloning behaviour from react/yoga#2058 in React Native's bundled Yoga. When a shared subtree contains both an already-zeroed child and a child that needs zeroing, clone only the latter. The existing implementation clones every unowned sibling as soon as one child needs changing.

Use cloneChildIfNeeded(i) before recursing into each child that needs zeroing. This preserves RN #59688's inlined cloneChildrenIfNeeded() loop and min-content fix.

Changelog:

[GENERAL] [FIXED] - Avoid unnecessary cloning of unchanged children in hidden layouts

Test Plan:

  • Built the bundled Yoga sources and the existing test/BaselineTest.cpp using the standalone CMake harness on macOS arm64 with Apple Clang 21.0.0 and GoogleTest 1.12.1.
  • All 16 existing native cases passed, including all 11 min-content cases.
  • git diff --check passed.

Commands run:

cmake --build /tmp/yoga-reconciliation-8hincgw0/build-rn --target rn_yoga_tests --parallel 4
/tmp/yoga-reconciliation-8hincgw0/build-rn/rn_yoga_tests

Full Fantom Text/View strict-layout regressions, Android/iOS builds, sanitizer checks, and pre-merge internal CI were not run in this validation.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 20, 2026
@cipolleschi
cipolleschi marked this pull request as ready for review November 20, 2026 17:19
@cipolleschi
cipolleschi enabled auto-merge (squash) November 20, 2026 17:34
@cipolleschi
cipolleschi merged commit a1987ab into react:main Nov 20, 2026
89 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants