Skip to content

Commit

Permalink
Remove YGExperimentalFeatureFixAbsoluteTrailingColumnMargin (facebook…
Browse files Browse the repository at this point in the history
…#37374)

Summary:
Pull Request resolved: facebook#37374

This is edge-casey enough, and I actually broke this in D42282358 without us noticing (I changed height to width of the bottom usage, instead, copy/pasting the value of the top one).

Reviewed By: yungsters

Differential Revision: D45766764

fbshipit-source-id: f6b3b0c3d842fee7854ccd8c284ef89624a1a42a
  • Loading branch information
NickGerleman authored and facebook-github-bot committed May 11, 2023
1 parent eafd1be commit 356630c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
package com.facebook.yoga;

public enum YogaExperimentalFeature {
WEB_FLEX_BASIS(0),
FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN(1);
WEB_FLEX_BASIS(0);

private final int mIntValue;

Expand All @@ -26,7 +25,6 @@ public int intValue() {
public static YogaExperimentalFeature fromInt(int value) {
switch (value) {
case 0: return WEB_FLEX_BASIS;
case 1: return FIX_ABSOLUTE_TRAILING_COLUMN_MARGIN;
default: throw new IllegalArgumentException("Unknown enum value: " + value);
}
}
Expand Down
2 changes: 0 additions & 2 deletions packages/react-native/ReactCommon/yoga/yoga/YGEnums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ const char* YGExperimentalFeatureToString(const YGExperimentalFeature value) {
switch (value) {
case YGExperimentalFeatureWebFlexBasis:
return "web-flex-basis";
case YGExperimentalFeatureFixAbsoluteTrailingColumnMargin:
return "fix-absolute-trailing-column-margin";
}
return "unknown";
}
Expand Down
3 changes: 1 addition & 2 deletions packages/react-native/ReactCommon/yoga/yoga/YGEnums.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ YG_DEFINE_ENUM_FLAG_OPERATORS(YGErrata)

YG_ENUM_SEQ_DECL(
YGExperimentalFeature,
YGExperimentalFeatureWebFlexBasis,
YGExperimentalFeatureFixAbsoluteTrailingColumnMargin)
YGExperimentalFeatureWebFlexBasis)

YG_ENUM_SEQ_DECL(
YGFlexDirection,
Expand Down
10 changes: 2 additions & 8 deletions packages/react-native/ReactCommon/yoga/yoga/Yoga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1543,19 +1543,13 @@ static void YGNodeAbsoluteLayoutChild(
depth,
generationCount);

auto trailingMarginOuterSize =
node->getConfig()->isExperimentalFeatureEnabled(
YGExperimentalFeatureFixAbsoluteTrailingColumnMargin)
? isMainAxisRow ? height : width
: width;

if (child->isTrailingPosDefined(mainAxis) &&
!child->isLeadingPositionDefined(mainAxis)) {
child->setLayoutPosition(
node->getLayout().measuredDimensions[dim[mainAxis]] -
child->getLayout().measuredDimensions[dim[mainAxis]] -
node->getTrailingBorder(mainAxis) -
child->getTrailingMargin(mainAxis, trailingMarginOuterSize)
child->getTrailingMargin(mainAxis, isMainAxisRow ? width : height)
.unwrap() -
child->getTrailingPosition(mainAxis, isMainAxisRow ? width : height)
.unwrap(),
Expand Down Expand Up @@ -1598,7 +1592,7 @@ static void YGNodeAbsoluteLayoutChild(
node->getLayout().measuredDimensions[dim[crossAxis]] -
child->getLayout().measuredDimensions[dim[crossAxis]] -
node->getTrailingBorder(crossAxis) -
child->getTrailingMargin(crossAxis, trailingMarginOuterSize)
child->getTrailingMargin(crossAxis, isMainAxisRow ? height : width)
.unwrap() -
child
->getTrailingPosition(crossAxis, isMainAxisRow ? height : width)
Expand Down

0 comments on commit 356630c

Please sign in to comment.