Skip to content

fix: yoga crash with display:none#1976

Closed
javache wants to merge 1 commit into
react:mainfrom
javache:export-D108796888
Closed

fix: yoga crash with display:none#1976
javache wants to merge 1 commit into
react:mainfrom
javache:export-D108796888

Conversation

@javache

@javache javache commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary:
It fixes this issue: react/react-native#52349
Basically, in some rare cases, having an element with display:none style caused the app to crash.

It was caused by a stale hasNewLayout flag on the hidden view
That flag was always set in computeFlexBasisForChildren for elements with display:none style, but could be never consumed/reset, because of a cache hit or something.
Since such elements contribute nothing to the layout sizes, I made the change to actually touch them only during actual layout passes

Changelog:

[GENERAL] [FIXED] - Crash: YogaLayoutableShadowNode.cpp: function layout: assertion failed (YGNodeGetOwner(childYogaNode) == &yogaNode_) react/react-native#52349

X-link: react/react-native#57197

Reviewed By: christophpurrer

Differential Revision: D108796888

Pulled By: javache

Summary:
It fixes this issue: react/react-native#52349
Basically, in some rare cases, having an element with `display:none` style caused the app to crash.

It was caused by a stale `hasNewLayout` flag on the hidden view
That flag was always set in `computeFlexBasisForChildren` for elements with `display:none` style, but could be never consumed/reset, because of a cache hit or something.
Since such elements contribute nothing to the layout sizes, I made the change to actually touch them only during actual layout passes

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[GENERAL] [FIXED] - Crash: YogaLayoutableShadowNode.cpp: function layout: assertion failed (YGNodeGetOwner(childYogaNode) == &yogaNode_) react/react-native#52349

X-link: react/react-native#57197

Reviewed By: christophpurrer

Differential Revision: D108796888

Pulled By: javache
@meta-cla meta-cla Bot added the CLA Signed label Jun 16, 2026
@meta-codesync

meta-codesync Bot commented Jun 16, 2026

Copy link
Copy Markdown

@javache has exported this pull request. If you are a Meta employee, you can view the originating Diff in D108796888.

meta-codesync Bot pushed a commit to react/react-native that referenced this pull request Jun 17, 2026
Summary:
X-link: react/yoga#1976

It fixes this issue: #52349
Basically, in some rare cases, having an element with `display:none` style caused the app to crash.

It was caused by a stale `hasNewLayout` flag on the hidden view
That flag was always set in `computeFlexBasisForChildren` for elements with `display:none` style, but could be never consumed/reset, because of a cache hit or something.
Since such elements contribute nothing to the layout sizes, I made the change to actually touch them only during actual layout passes

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[GENERAL] [FIXED] - Crash: YogaLayoutableShadowNode.cpp: function layout: assertion failed (YGNodeGetOwner(childYogaNode) == &yogaNode_) #52349

Pull Request resolved: #57197

Test Plan:
I created a reproduction repo: https://github.com/5ZYSZ3K/native-tabs-crash-repro, to see the issue
And to see, that my change fixes it, you can switch to `patch-yoga` branch there, and install it again (don't forget to install pods with `RCT_USE_PREBUILT_RNCORE=0 RCT_USE_RN_DEP=0` variables)

Reviewed By: christophpurrer

Differential Revision: D108796888

Pulled By: javache

fbshipit-source-id: 455e3ddbec760dbee875c02f0ed6266b9a417e9a
@meta-codesync meta-codesync Bot closed this in b7ff95d Jun 17, 2026
@meta-codesync meta-codesync Bot added the Merged label Jun 17, 2026
@meta-codesync

meta-codesync Bot commented Jun 17, 2026

Copy link
Copy Markdown

@javache merged this pull request in b7ff95d.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants