From d98a22920294b28797dbcde8a1cab9a25c5fccaf Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Tue, 3 Mar 2020 04:10:31 -0800 Subject: [PATCH] Pass layoutContext to Yoga's MeasureCallback Summary: In order to build dynamic text sizing, we need to pass layoutContext to `yogaNodeMeasureCallbackConnector` Changelog: [Internal] Reviewed By: shergin Differential Revision: D20184597 fbshipit-source-id: 9df7da4bef8cbad3bc87d63ed0c5aa5f420dbc11 --- .../components/view/yoga/YogaLayoutableShadowNode.cpp | 10 +++++++--- .../components/view/yoga/YogaLayoutableShadowNode.h | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp b/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp index f4bd3ca6ddd..0c87c9094ec 100644 --- a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp +++ b/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.cpp @@ -245,8 +245,11 @@ void YogaLayoutableShadowNode::layoutTree( { SystraceSection s("YogaLayoutableShadowNode::YGNodeCalculateLayout"); - YGNodeCalculateLayout( - &yogaNode_, availableWidth, availableHeight, YGDirectionInherit); + YGNodeCalculateLayoutWithContext(&yogaNode_, + availableWidth, + availableHeight, + YGDirectionInherit, + &layoutContext); } layout(layoutContext); @@ -320,7 +323,8 @@ YGSize YogaLayoutableShadowNode::yogaNodeMeasureCallbackConnector( float width, YGMeasureMode widthMode, float height, - YGMeasureMode heightMode) { + YGMeasureMode heightMode, + void *layoutContext) { SystraceSection s( "YogaLayoutableShadowNode::yogaNodeMeasureCallbackConnector"); diff --git a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h b/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h index ceb0de20f6a..303609b7541 100644 --- a/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h +++ b/ReactCommon/fabric/components/view/yoga/YogaLayoutableShadowNode.h @@ -121,7 +121,8 @@ class YogaLayoutableShadowNode : public LayoutableShadowNode { float width, YGMeasureMode widthMode, float height, - YGMeasureMode heightMode); + YGMeasureMode heightMode, + void *layoutContext); }; template <>