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
This commit is contained in:
David Aurelio
2019-05-09 04:14:08 -07:00
committed by Facebook Github Bot
parent e96a09e5ff
commit 5824dbda66
3 changed files with 47 additions and 17 deletions

View File

@@ -3667,6 +3667,9 @@ bool YGLayoutNodeInternal(
const YGConfigRef config,
YGMarkerLayoutData& layoutMarkerData,
void* const layoutContext) {
#ifdef YG_ENABLE_EVENTS
Event::publish<Event::NodeLayout>(node);
#endif
YGLayout* layout = &node->getLayout();
gDepth++;

View File

@@ -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);