mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 11:34:23 +00:00
Yoga test failure for flexing with min stack dimension
Reviewed By: emilsjolander Differential Revision: D4558653 fbshipit-source-id: 06b38d7ed43aee063cc881f38b84558641f043f3
This commit is contained in:
parent
761d528153
commit
1209b39492
@ -14,7 +14,8 @@ import com.facebook.proguard.annotations.DoNotStrip;
|
|||||||
@DoNotStrip
|
@DoNotStrip
|
||||||
public enum YogaExperimentalFeature {
|
public enum YogaExperimentalFeature {
|
||||||
ROUNDING(0),
|
ROUNDING(0),
|
||||||
WEB_FLEX_BASIS(1);
|
WEB_FLEX_BASIS(1),
|
||||||
|
MIN_FLEX_FIX(2);
|
||||||
|
|
||||||
private int mIntValue;
|
private int mIntValue;
|
||||||
|
|
||||||
@ -30,6 +31,7 @@ public enum YogaExperimentalFeature {
|
|||||||
switch (value) {
|
switch (value) {
|
||||||
case 0: return ROUNDING;
|
case 0: return ROUNDING;
|
||||||
case 1: return WEB_FLEX_BASIS;
|
case 1: return WEB_FLEX_BASIS;
|
||||||
|
case 2: return MIN_FLEX_FIX;
|
||||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,10 +57,11 @@ typedef YG_ENUM_BEGIN(YGEdge) {
|
|||||||
YGEdgeAll,
|
YGEdgeAll,
|
||||||
} YG_ENUM_END(YGEdge);
|
} YG_ENUM_END(YGEdge);
|
||||||
|
|
||||||
#define YGExperimentalFeatureCount 2
|
#define YGExperimentalFeatureCount 3
|
||||||
typedef YG_ENUM_BEGIN(YGExperimentalFeature) {
|
typedef YG_ENUM_BEGIN(YGExperimentalFeature) {
|
||||||
YGExperimentalFeatureRounding,
|
YGExperimentalFeatureRounding,
|
||||||
YGExperimentalFeatureWebFlexBasis,
|
YGExperimentalFeatureWebFlexBasis,
|
||||||
|
YGExperimentalFeatureMinFlexFix,
|
||||||
} YG_ENUM_END(YGExperimentalFeature);
|
} YG_ENUM_END(YGExperimentalFeature);
|
||||||
|
|
||||||
#define YGFlexDirectionCount 4
|
#define YGFlexDirectionCount 4
|
||||||
|
@ -1960,11 +1960,13 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||||||
// above
|
// above
|
||||||
float availableInnerWidth = availableWidth - marginAxisRow - paddingAndBorderAxisRow;
|
float availableInnerWidth = availableWidth - marginAxisRow - paddingAndBorderAxisRow;
|
||||||
if (!YGFloatIsUndefined(availableInnerWidth)) {
|
if (!YGFloatIsUndefined(availableInnerWidth)) {
|
||||||
|
// We want to make sure our available width does not violate min and max constraints
|
||||||
availableInnerWidth = fmaxf(fminf(availableInnerWidth, maxInnerWidth), minInnerWidth);
|
availableInnerWidth = fmaxf(fminf(availableInnerWidth, maxInnerWidth), minInnerWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
float availableInnerHeight = availableHeight - marginAxisColumn - paddingAndBorderAxisColumn;
|
float availableInnerHeight = availableHeight - marginAxisColumn - paddingAndBorderAxisColumn;
|
||||||
if (!YGFloatIsUndefined(availableInnerHeight)) {
|
if (!YGFloatIsUndefined(availableInnerHeight)) {
|
||||||
|
// We want to make sure our available height does not violate min and max constraints
|
||||||
availableInnerHeight = fmaxf(fminf(availableInnerHeight, maxInnerHeight), minInnerHeight);
|
availableInnerHeight = fmaxf(fminf(availableInnerHeight, maxInnerHeight), minInnerHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2149,13 +2151,16 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||||||
// If the main dimension size isn't known, it is computed based on
|
// If the main dimension size isn't known, it is computed based on
|
||||||
// the line length, so there's no more space left to distribute.
|
// the line length, so there's no more space left to distribute.
|
||||||
|
|
||||||
// We resolve main dimension to fit minimum and maximum values
|
// If we don't measure with exact main dimension we want to ensure we don't violate min and max
|
||||||
if (YGFloatIsUndefined(availableInnerMainDim)) {
|
if (measureModeMainDim != YGMeasureModeExactly) {
|
||||||
if (!YGFloatIsUndefined(minInnerMainDim) && sizeConsumedOnCurrentLine < minInnerMainDim) {
|
if (!YGFloatIsUndefined(minInnerMainDim) && sizeConsumedOnCurrentLine < minInnerMainDim) {
|
||||||
availableInnerMainDim = minInnerMainDim;
|
availableInnerMainDim = minInnerMainDim;
|
||||||
} else if (!YGFloatIsUndefined(maxInnerMainDim) &&
|
} else if (!YGFloatIsUndefined(maxInnerMainDim) && sizeConsumedOnCurrentLine > maxInnerMainDim) {
|
||||||
sizeConsumedOnCurrentLine > maxInnerMainDim) {
|
|
||||||
availableInnerMainDim = maxInnerMainDim;
|
availableInnerMainDim = maxInnerMainDim;
|
||||||
|
} else if (YGIsExperimentalFeatureEnabled(YGExperimentalFeatureMinFlexFix)) {
|
||||||
|
// TODO: this needs to be moved out of experimental feature, as this is legitimate fix
|
||||||
|
// If the measurement isn't exact, we want to use as little space as possible
|
||||||
|
availableInnerMainDim = sizeConsumedOnCurrentLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user