Skip to content

Fix auto-sized parent not accounting for child min-width in canSkipFlex path#1905

Open
joshjhargreaves wants to merge 2 commits intofacebook:mainfrom
joshjhargreaves:pr/jhargreaves/fix-auto-min-width
Open

Fix auto-sized parent not accounting for child min-width in canSkipFlex path#1905
joshjhargreaves wants to merge 2 commits intofacebook:mainfrom
joshjhargreaves:pr/jhargreaves/fix-auto-min-width

Conversation

@joshjhargreaves
Copy link

@joshjhargreaves joshjhargreaves commented Mar 2, 2026

When a flex container with auto main-axis is measured with a with a known cross dimensions, the canSkipFlex optimization in justifyMainAxis uses computedFlexBasis directly. This doesn't account for the min & max width constraints, causing the parent to undersize.

I have added a .html test page here to mirror the C++ test I added to confirm that flexbox does respect the min-width constraint. minwidth-test.html

@vercel
Copy link

vercel bot commented Mar 2, 2026

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

Project Deployment Actions Updated (UTC)
yoga-website Ready Ready Preview, Comment Mar 2, 2026 9:28pm

Request Review

@meta-cla meta-cla bot added the CLA Signed label Mar 2, 2026
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Mar 2, 2026
@NickGerleman
Copy link
Contributor

@joshjhargreaves could you run yarn gentest and check in the resulting generated tests?

@joshjhargreaves
Copy link
Author

@NickGerleman I ran the script & there are no files to check in - this modifies an existing test file & doesn't create a new one, fwiw.

@meta-codesync
Copy link

meta-codesync bot commented Mar 4, 2026

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

NickGerleman pushed a commit to NickGerleman/react-native that referenced this pull request Mar 20, 2026
…ex path

Summary:
When a flex container with auto main-axis is measured with a with a known cross dimensions, the `canSkipFlex` optimization in `justifyMainAxis` uses `computedFlexBasis` directly. This doesn't account for the `min` & `max` width constraints, causing the parent to undersize.


I have added a `.html` test page here to mirror the C++ test I added to confirm that flexbox does respect the min-width constraint. [minwidth-test.html](https://github.com/user-attachments/files/25695677/minwidth-test.html)

Changelog: [internal]

X-link: facebook/yoga#1905

Reviewed By: sammy-SC, adityasharat

Differential Revision: D95177338

Pulled By: NickGerleman
NickGerleman pushed a commit to NickGerleman/react-native that referenced this pull request Mar 20, 2026
…ex path

Summary:
When a flex container with auto main-axis is measured with a with a known cross dimensions, the `canSkipFlex` optimization in `justifyMainAxis` uses `computedFlexBasis` directly. This doesn't account for the `min` & `max` width constraints, causing the parent to undersize.


I have added a `.html` test page here to mirror the C++ test I added to confirm that flexbox does respect the min-width constraint. [minwidth-test.html](https://github.com/user-attachments/files/25695677/minwidth-test.html)

Changelog: [Internal]

X-link: facebook/yoga#1905

Reviewed By: sammy-SC, adityasharat

Differential Revision: D95177338

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

Labels

CLA Signed 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.

4 participants