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 onLayoutPassEnd(YogaNode node);
|
||||||
|
|
||||||
|
void onNodeMeasure(YogaNode node);
|
||||||
|
|
||||||
}
|
}
|
@@ -131,6 +131,8 @@ void EventTest::listen(const YGNode& node, Event::Type type, Event::Data data) {
|
|||||||
break;
|
break;
|
||||||
case Event::LayoutPassEnd:
|
case Event::LayoutPassEnd:
|
||||||
break;
|
break;
|
||||||
|
case Event::NodeMeasure:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1635,6 +1635,10 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(
|
|||||||
heightMeasureMode,
|
heightMeasureMode,
|
||||||
layoutContext);
|
layoutContext);
|
||||||
|
|
||||||
|
#ifdef YG_ENABLE_EVENTS
|
||||||
|
Event::publish<Event::NodeMeasure>(node, {layoutContext});
|
||||||
|
#endif
|
||||||
|
|
||||||
node->setLayoutMeasuredDimension(
|
node->setLayoutMeasuredDimension(
|
||||||
YGNodeBoundAxis(
|
YGNodeBoundAxis(
|
||||||
node,
|
node,
|
||||||
|
@@ -21,7 +21,8 @@ struct Event {
|
|||||||
NodeDeallocation,
|
NodeDeallocation,
|
||||||
NodeLayout,
|
NodeLayout,
|
||||||
LayoutPassStart,
|
LayoutPassStart,
|
||||||
LayoutPassEnd
|
LayoutPassEnd,
|
||||||
|
NodeMeasure,
|
||||||
};
|
};
|
||||||
class Data;
|
class Data;
|
||||||
using Subscriber = void(const YGNode&, Type, Data);
|
using Subscriber = void(const YGNode&, Type, Data);
|
||||||
@@ -76,5 +77,10 @@ struct Event::TypedData<Event::LayoutPassEnd> {
|
|||||||
void* layoutContext;
|
void* layoutContext;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct Event::TypedData<Event::NodeMeasure> {
|
||||||
|
void* layoutContext;
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace yoga
|
} // namespace yoga
|
||||||
} // namespace facebook
|
} // namespace facebook
|
||||||
|
Reference in New Issue
Block a user