Skip to content

Commit

Permalink
Publish event when visiting nodes during layout
Browse files Browse the repository at this point in the history
Summary:
@public

Publish an event when visiting nodes during layouts.

Reviewed By: SidharthGuglani

Differential Revision: D15206965

fbshipit-source-id: c201f084b1d4186bc64560b8033be965f2549236
  • Loading branch information
davidaurelio authored and facebook-github-bot committed May 9, 2019
1 parent 7d44113 commit 6ccdf85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ReactCommon/yoga/yoga/Yoga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down
2 changes: 1 addition & 1 deletion ReactCommon/yoga/yoga/events.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 6ccdf85

Please sign in to comment.