Skip to content

Navigation Menu

Sign in
Sign up

Layout breaks when the first element has a different minWidth than the rest #58395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pasqualeanatriello wants to merge 1 commit into react:main
base: main
Choose a base branch
Loading
from pasqualeanatriello:export-D119142409
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,19 @@ static void distributeFreeSpaceFirstPass(
float boundMainSize = 0;
float deltaFreeSpace = 0;

// The first pass performs a single distribution of the free space over all
// of the line's flexible items, so every item's tentative size must be
// computed against the *original* totals. The totals are still reduced as
// items get frozen below (so the second pass can redistribute), but those
// reduced values must not feed back into the fair-share calculation for the
// remaining items: doing so inflates their tentative size and can freeze
// items that should still be able to grow/shrink (see
// https://github.com/react/yoga/issues/2006).
const float originalTotalFlexGrowFactors =
flexLine.layout.totalFlexGrowFactors;
const float originalTotalFlexShrinkScaledFactors =
flexLine.layout.totalFlexShrinkScaledFactors;

for (auto currentLineChild : flexLine.itemsInFlow) {
float childFlexBasis = boundAxisWithinMinAndMax(
currentLineChild,
Expand All @@ -1299,8 +1312,7 @@ static void distributeFreeSpaceFirstPass(
flexShrinkScaledFactor != 0) {
baseMainSize = childFlexBasis +
flexLine.layout.remainingFreeSpace /
flexLine.layout.totalFlexShrinkScaledFactors *
flexShrinkScaledFactor;
originalTotalFlexShrinkScaledFactors * flexShrinkScaledFactor;
boundMainSize = boundAxisWithAutoMin(
currentLineChild,
mainAxis,
Expand Down Expand Up @@ -1328,8 +1340,8 @@ static void distributeFreeSpaceFirstPass(
// Is this child able to grow?
if (yoga::isDefined(flexGrowFactor) && flexGrowFactor != 0) {
baseMainSize = childFlexBasis +
flexLine.layout.remainingFreeSpace /
flexLine.layout.totalFlexGrowFactors * flexGrowFactor;
flexLine.layout.remainingFreeSpace / originalTotalFlexGrowFactors *
flexGrowFactor;
boundMainSize = boundAxis(
currentLineChild,
mainAxis,
Expand Down
Loading

AltStyle によって変換されたページ (->オリジナル) /