Skip to content

Expose HadOverflow property in JavaScript bindings#1930

Closed
J8118 wants to merge 4 commits into
facebook:mainfrom
J8118:feat/expose-had-overflow-js
Closed

Expose HadOverflow property in JavaScript bindings#1930
J8118 wants to merge 4 commits into
facebook:mainfrom
J8118:feat/expose-had-overflow-js

Conversation

@J8118
Copy link
Copy Markdown
Contributor

@J8118 J8118 commented Apr 9, 2026

Summary

The C API provides YGNodeLayoutGetHadOverflow() to check whether a node's layout had overflow, but this was not exposed in the JavaScript bindings. This PR adds:

  • getComputedHadOverflow(): boolean — standalone method on Node
  • hadOverflow: boolean field in the Layout type returned by getComputedLayout()

The implementation follows the exact same pattern as existing layout getters (e.g., getComputedWidth, getComputedHeight) and boolean accessors (e.g., hasNewLayout).

Closes #1773

Test plan

  • Added YGHadOverflowTest.test.ts with 4 test cases ported from the C++ test suite (tests/YGHadOverflowTest.cpp):
    • Children overflow with no wrap and no flex → hadOverflow is true
    • No overflow with flex children that shrink → hadOverflow is false
    • Overflow flag resets when layout changes → true then false
    • getComputedLayout() includes hadOverflow field
  • Full test suite passes: 38 suites, 574 tests, 0 failures

Add getComputedHadOverflow() method and include hadOverflow in the
Layout type returned by getComputedLayout(). This exposes the existing
C API function YGNodeLayoutGetHadOverflow() which was previously
missing from the JS bindings.

Closes facebook#1773
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
yoga-website Ready Ready Preview, Comment Apr 9, 2026 6:46pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed label Apr 9, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Apr 9, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Apr 9, 2026

@fabriziocucci has imported this pull request. If you are a Meta employee, you can view this in D100144528.

@meta-codesync
Copy link
Copy Markdown

meta-codesync Bot commented Apr 13, 2026

@fabriziocucci merged this pull request in 02d8ec6.

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

Labels

CLA Signed Merged Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JS bindings: Expose HadOverflow property

1 participant