From 6ccdf85cefeaac6872398d605685cd9ac2a26211 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Thu, 9 May 2019 04:14:08 -0700 Subject: [PATCH] Publish event when visiting nodes during layout Summary: @public Publish an event when visiting nodes during layouts. Reviewed By: SidharthGuglani Differential Revision: D15206965 fbshipit-source-id: c201f084b1d4186bc64560b8033be965f2549236 --- ReactCommon/yoga/yoga/Yoga.cpp | 3 +++ ReactCommon/yoga/yoga/events.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ReactCommon/yoga/yoga/Yoga.cpp b/ReactCommon/yoga/yoga/Yoga.cpp index 05fb10d278f..5f6fa875e0b 100644 --- a/ReactCommon/yoga/yoga/Yoga.cpp +++ b/ReactCommon/yoga/yoga/Yoga.cpp @@ -3667,6 +3667,9 @@ bool YGLayoutNodeInternal( const YGConfigRef config, YGMarkerLayoutData& layoutMarkerData, void* const layoutContext) { +#ifdef YG_ENABLE_EVENTS + Event::publish(node); +#endif YGLayout* layout = &node->getLayout(); gDepth++; diff --git a/ReactCommon/yoga/yoga/events.h b/ReactCommon/yoga/yoga/events.h index 7b04060a89a..e667d2d2bde 100644 --- a/ReactCommon/yoga/yoga/events.h +++ b/ReactCommon/yoga/yoga/events.h @@ -15,7 +15,7 @@ namespace facebook { namespace yoga { struct Event { - enum Type { NodeAllocation, NodeDeallocation }; + enum Type { NodeAllocation, NodeDeallocation, NodeLayout }; class Data; using Subscriber = void(const YGNode&, Type, Data);