Skip to content

Fix typo - #2055

Closed
jasssonpet wants to merge 1 commit into
react:masterfrom
jasssonpet:patch-1
Closed

jasssonpet wants to merge 1 commit into
react:masterfrom
jasssonpet:patch-1

Conversation

@jasssonpet

Copy link
Copy Markdown
Contributor

No description provided.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

@facebook-github-bot

Copy link
Copy Markdown
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot facebook-github-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 Jul 20, 2015
@brentvatne

Copy link
Copy Markdown
Collaborator

Looks good to me

@ericvicenti

Copy link
Copy Markdown
Contributor

@facebook-github-bot import

@facebook-github-bot

Copy link
Copy Markdown
Contributor

Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/1586951251571006/int_phab to review.

cipolleschi pushed a commit that referenced this pull request Nov 3, 2026
…2055) (#59777)

Co-authored-by: Open Source Bot <generatedunixname499836121@meta.com>
usama-liaqat pushed a commit to usama-liaqat/react-native that referenced this pull request Nov 14, 2026
…eact#2055) (react#59777)

Co-authored-by: Open Source Bot <generatedunixname499836121@meta.com>
meta-codesync Bot pushed a commit that referenced this pull request Dec 4, 2026
…#2137)

Summary:
Why
===

A `wrap-reverse` container ends its layout by mirroring each child's cross-axis position, computed from the child's measured size. A `display: none` child has no measured size, so its position becomes NaN where a browser reports 0:

```html
<div style="width: 100px; height: 100px; flex-direction: row; flex-wrap: wrap-reverse">
  <div style="width: 20px; height: 20px"></div>
  <div style="width: 20px; height: 20px; display: none">
    <div style="width: 10px; height: 10px"></div>
  </div>
</div>
```

Pixel-grid rounding then derives each size from the absolute position, so the hidden child and its descendants also get a NaN height (a NaN width in a column container). A hidden subtree with NaN in its layout never counts as zeroed out, with or without rounding, so `zeroOutLayoutRecursively` clones all of it on every layout of the container, which is the work #2055 and #2058 removed for other containers.

How
===

The loop that mirrors positions skips `display: none` children, as the loop that sets trailing positions after it does. No erratum gates this: the old values are NaN, which no layout can depend on.

Test Plan
=========

`yarn gentest -f YGDisplayTest` adds `display_none_in_wrap_reverse` from the markup above, with Chrome's values. `cmake --build tests/build && tests/build/yogatests` passes. With `yoga/algorithm/CalculateLayout.cpp` reverted, the new test fails: the hidden child's top is NaN where Chrome has 0, and its height and its child's height are NaN.

`relayout_does_not_clone_zeroed_out_display_none_subtree_in_wrap_reverse` in `YGPersistentNodeCloningTest.cpp` checks the cloning: a relayout clones the hidden child, which the two trees share, and not its child. On `main` it clones both.

`yarn format-check` and `yarn lint` pass. Not run: the generated Java and JavaScript tests.

Changelog:
[General][Fixed] - Fix Yoga giving a `display: none` child of a `wrap-reverse` container a NaN position and size

Reviewed By: javache

Differential Revision: D135511404

Pull Request resolved: #60544
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants