Skip to content

Commit

Permalink
pass measure callback data from c++ to java
Browse files Browse the repository at this point in the history
Summary:
Passing Measure callback data - width, widthMeasureMode, height, heightMeasureMode, measuredWidth and measuredHeight along with NodeMeasure event
This data is then propagated to java layer in this diff

Reviewed By: davidaurelio

Differential Revision: D15697523

fbshipit-source-id: 615463da237175ff88abef3f6528b55333ccd915
  • Loading branch information
SidharthGuglani-zz authored and facebook-github-bot committed Jun 12, 2019
1 parent 0a66ded commit 38adb8e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ReactCommon/yoga/yoga/Yoga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1636,7 +1636,15 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions(
layoutContext);

#ifdef YG_ENABLE_EVENTS
Event::publish<Event::NodeMeasure>(node, {layoutContext});
Event::publish<Event::NodeMeasure>(
node,
{layoutContext,
innerWidth,
widthMeasureMode,
innerHeight,
heightMeasureMode,
measuredSize.width,
measuredSize.height});
#endif

node->setLayoutMeasuredDimension(
Expand Down
7 changes: 7 additions & 0 deletions ReactCommon/yoga/yoga/event/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <functional>
#include <vector>
#include "../YGEnums.h"

struct YGConfig;
struct YGNode;
Expand Down Expand Up @@ -85,6 +86,12 @@ struct Event::TypedData<Event::LayoutPassEnd> {
template <>
struct Event::TypedData<Event::NodeMeasure> {
void* layoutContext;
float width;
YGMeasureMode widthMeasureMode;
float height;
YGMeasureMode heightMeasureMode;
float measuredWidth;
float measuredHeight;
};

template <>
Expand Down

0 comments on commit 38adb8e

Please sign in to comment.