Skip to content

Commit 89f4ca4

Browse files
rozelefacebook-github-bot
authored andcommitted
Fix issue with flexShrink
Summary: X-link: facebook/react-native#53758 In cases where the remaining space for flex shrink is negative, we can get into a state where the `totalFlexShrinkScaledFactors` get's infintesimally small, but likely should just be floored to zero. This manifests in issues where flexShrink nodes are suddenly given way too much space, and generally only manifests in an issue if these flexShrink nodes have self-measuring children (such as text). Checking if the value is approximately zero appears to fix bugs for flexShrink. Reviewed By: andrewdacenko Differential Revision: D82313674
1 parent dc2581f commit 89f4ca4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

yoga/algorithm/CalculateLayout.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,8 @@ static float distributeFreeSpaceSecondPass(
661661
float childSize = YGUndefined;
662662

663663
if (yoga::isDefined(flexLine.layout.totalFlexShrinkScaledFactors) &&
664-
flexLine.layout.totalFlexShrinkScaledFactors == 0) {
664+
yoga::inexactEquals(
665+
flexLine.layout.totalFlexShrinkScaledFactors, 0.0f)) {
665666
childSize = childFlexBasis + flexShrinkScaledFactor;
666667
} else {
667668
childSize = childFlexBasis +

0 commit comments

Comments
 (0)