Fabric: Proxying `LayoutConstraints::direction` down to RootNode's styles
Summary: Trivial. We have to proxy layout directions as well as min and max sizes to RootNode's Props to properly communicate the constrains to Yoga. Reviewed By: sahrens Differential Revision: D10387798 fbshipit-source-id: a02ec0a20b3ef28f6230738e5b3a4a2b0b8e0961
This commit is contained in:
parent
d73254b441
commit
f2da2d1963
|
@ -26,6 +26,9 @@ static YGStyle yogaStyleFromLayoutConstraints(
|
||||||
yogaStyle.maxDimensions[YGDimensionHeight] =
|
yogaStyle.maxDimensions[YGDimensionHeight] =
|
||||||
yogaStyleValueFromFloat(layoutConstraints.maximumSize.height);
|
yogaStyleValueFromFloat(layoutConstraints.maximumSize.height);
|
||||||
|
|
||||||
|
yogaStyle.direction =
|
||||||
|
yogaDirectionFromLayoutDirection(layoutConstraints.layoutDirection);
|
||||||
|
|
||||||
return yogaStyle;
|
return yogaStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,17 @@ inline LayoutMetrics layoutMetricsFromYogaNode(YGNode &yogaNode) {
|
||||||
return layoutMetrics;
|
return layoutMetrics;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline YGDirection yogaDirectionFromLayoutDirection(LayoutDirection direction) {
|
||||||
|
switch (direction) {
|
||||||
|
case LayoutDirection::Undefined:
|
||||||
|
return YGDirectionInherit;
|
||||||
|
case LayoutDirection::LeftToRight:
|
||||||
|
return YGDirectionLTR;
|
||||||
|
case LayoutDirection::RightToLeft:
|
||||||
|
return YGDirectionRTL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
inline void fromDynamic(const folly::dynamic &value, YGDirection &result) {
|
inline void fromDynamic(const folly::dynamic &value, YGDirection &result) {
|
||||||
assert(value.isString());
|
assert(value.isString());
|
||||||
auto stringValue = value.asString();
|
auto stringValue = value.asString();
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace react {
|
||||||
struct LayoutConstraints {
|
struct LayoutConstraints {
|
||||||
Size minimumSize{0, 0};
|
Size minimumSize{0, 0};
|
||||||
Size maximumSize{kFloatUndefined, kFloatUndefined};
|
Size maximumSize{kFloatUndefined, kFloatUndefined};
|
||||||
LayoutDirection layoutDirection;
|
LayoutDirection layoutDirection{LayoutDirection::Undefined};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace react
|
} // namespace react
|
||||||
|
|
Loading…
Reference in New Issue