add node layout event and pass it java layer

Summary: Listen to NodeLayout event and passes this event callback to java layer along with the information whether layout or measure was done in this pass

Reviewed By: davidaurelio

Differential Revision: D15696021

fbshipit-source-id: 8c5ca69330a9baca26b77052d4965cc67fe97c75
This commit is contained in:
Sidharth Guglani
2019-06-10 01:43:25 -07:00
committed by Facebook Github Bot
parent e33123f955
commit af219f8836
3 changed files with 9 additions and 1 deletions

View File

@@ -12,4 +12,6 @@ public interface YogaEventListener {
void onNodeMeasure(YogaNode node); void onNodeMeasure(YogaNode node);
void onNodeLayout(YogaNode node, boolean performLayout);
} }

View File

@@ -3670,7 +3670,7 @@ bool YGLayoutNodeInternal(
YGMarkerLayoutData& layoutMarkerData, YGMarkerLayoutData& layoutMarkerData,
void* const layoutContext) { void* const layoutContext) {
#ifdef YG_ENABLE_EVENTS #ifdef YG_ENABLE_EVENTS
Event::publish<Event::NodeLayout>(node); Event::publish<Event::NodeLayout>(node, {performLayout, layoutContext});
#endif #endif
YGLayout* layout = &node->getLayout(); YGLayout* layout = &node->getLayout();

View File

@@ -82,5 +82,11 @@ struct Event::TypedData<Event::NodeMeasure> {
void* layoutContext; void* layoutContext;
}; };
template <>
struct Event::TypedData<Event::NodeLayout> {
bool performLayout;
void* layoutContext;
};
} // namespace yoga } // namespace yoga
} // namespace facebook } // namespace facebook