diff --git a/ReactAndroid/src/main/java/com/facebook/yoga/YogaEventListener.java b/ReactAndroid/src/main/java/com/facebook/yoga/YogaEventListener.java index 6d1d486be28..97791224577 100644 --- a/ReactAndroid/src/main/java/com/facebook/yoga/YogaEventListener.java +++ b/ReactAndroid/src/main/java/com/facebook/yoga/YogaEventListener.java @@ -10,4 +10,6 @@ public interface YogaEventListener { void onLayoutPassEnd(YogaNode node); -} \ No newline at end of file + void onNodeMeasure(YogaNode node); + +} diff --git a/ReactCommon/yoga/yoga/Yoga.cpp b/ReactCommon/yoga/yoga/Yoga.cpp index 763d9bfcdca..c46104be1d3 100644 --- a/ReactCommon/yoga/yoga/Yoga.cpp +++ b/ReactCommon/yoga/yoga/Yoga.cpp @@ -1635,6 +1635,10 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions( heightMeasureMode, layoutContext); +#ifdef YG_ENABLE_EVENTS + Event::publish(node, {layoutContext}); +#endif + node->setLayoutMeasuredDimension( YGNodeBoundAxis( node, diff --git a/ReactCommon/yoga/yoga/event/event.h b/ReactCommon/yoga/yoga/event/event.h index f0f427974a5..bff8dbfd895 100644 --- a/ReactCommon/yoga/yoga/event/event.h +++ b/ReactCommon/yoga/yoga/event/event.h @@ -21,7 +21,8 @@ struct Event { NodeDeallocation, NodeLayout, LayoutPassStart, - LayoutPassEnd + LayoutPassEnd, + NodeMeasure, }; class Data; using Subscriber = void(const YGNode&, Type, Data); @@ -76,5 +77,10 @@ struct Event::TypedData { void* layoutContext; }; +template <> +struct Event::TypedData { + void* layoutContext; +}; + } // namespace yoga } // namespace facebook