add node measure event and passing the callback to java layer
Summary: Adds measure event and its listener initial code structure Reviewed By: davidaurelio Differential Revision: D15600738 fbshipit-source-id: d15764e0b64edb170fcb15e0912ecce5f7e53595
This commit is contained in:
committed by
Facebook Github Bot
parent
2701d80078
commit
755fa07b39
@@ -10,4 +10,6 @@ public interface YogaEventListener {
|
||||
|
||||
void onLayoutPassEnd(YogaNode node);
|
||||
|
||||
}
|
||||
void onNodeMeasure(YogaNode node);
|
||||
|
||||
}
|
||||
|
@@ -131,6 +131,8 @@ void EventTest::listen(const YGNode& node, Event::Type type, Event::Data data) {
|
||||
break;
|
||||
case Event::LayoutPassEnd:
|
||||
break;
|
||||
case Event::NodeMeasure:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1635,6 +1635,10 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(
|
||||
heightMeasureMode,
|
||||
layoutContext);
|
||||
|
||||
#ifdef YG_ENABLE_EVENTS
|
||||
Event::publish<Event::NodeMeasure>(node, {layoutContext});
|
||||
#endif
|
||||
|
||||
node->setLayoutMeasuredDimension(
|
||||
YGNodeBoundAxis(
|
||||
node,
|
||||
|
@@ -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<Event::LayoutPassEnd> {
|
||||
void* layoutContext;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct Event::TypedData<Event::NodeMeasure> {
|
||||
void* layoutContext;
|
||||
};
|
||||
|
||||
} // namespace yoga
|
||||
} // namespace facebook
|
||||
|
Reference in New Issue
Block a user