Skip to content

Commit

Permalink
Adds fixes for react-native-windows UWP (#848)
Browse files Browse the repository at this point in the history
Summary:
Specifically, updates the UWP .vcxproj for MSBuild and also exposes the UseLegacyStretchBehaviour API for use with react-native-windows.
Pull Request resolved: facebook/yoga#848

Reviewed By: SidharthGuglani

Differential Revision: D13848609

Pulled By: davidaurelio

fbshipit-source-id: eab046ff3c47e49706f515e209d8aaf750c2198f
  • Loading branch information
rozele authored and facebook-github-bot committed Jan 31, 2019
1 parent c435ff3 commit dfcbf97
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
8 changes: 0 additions & 8 deletions ReactCommon/yoga/yoga/YGMacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@
#define WIN_EXPORT
#endif

#ifdef WINARMDLL
#define WIN_STRUCT(type) type*
#define WIN_STRUCT_REF(value) &value
#else
#define WIN_STRUCT(type) type
#define WIN_STRUCT_REF(value) value
#endif

#ifdef NS_ENUM
// Cannot use NSInteger as NSInteger has a different size than int (which is the
// default type of a enum). Therefor when linking the Yoga C library into obj-c
Expand Down
9 changes: 4 additions & 5 deletions ReactCommon/yoga/yoga/Yoga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,12 +602,12 @@ inline detail::CompactValue Value::create<YGUnitAuto>(float) {
template <YGStyle::Dimensions YGStyle::*P>
struct DimensionProp {
template <YGDimension idx>
static WIN_STRUCT(YGValue) get(YGNodeRef node) {
static YGValue get(YGNodeRef node) {
YGValue value = (node->getStyle().*P)[idx];
if (value.unit == YGUnitUndefined || value.unit == YGUnitAuto) {
value.value = YGUndefined;
}
return WIN_STRUCT_REF(value);
return value;
}

template <YGDimension idx, YGUnit U>
Expand Down Expand Up @@ -690,13 +690,12 @@ struct DimensionProp {
} \
} \
\
WIN_STRUCT(type) \
YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge) { \
type YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge) { \
YGValue value = node->getStyle().instanceName[edge]; \
if (value.unit == YGUnitUndefined || value.unit == YGUnitAuto) { \
value.value = YGUndefined; \
} \
return WIN_STRUCT_REF(value); \
return value; \
}

#define YG_NODE_LAYOUT_PROPERTY_IMPL(type, name, instanceName) \
Expand Down
10 changes: 5 additions & 5 deletions ReactCommon/yoga/yoga/Yoga.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ YGDirtiedFunc YGNodeGetDirtiedFunc(YGNodeRef node);
void YGNodeSetDirtiedFunc(YGNodeRef node, YGDirtiedFunc dirtiedFunc);
YGPrintFunc YGNodeGetPrintFunc(YGNodeRef node);
void YGNodeSetPrintFunc(YGNodeRef node, YGPrintFunc printFunc);
bool YGNodeGetHasNewLayout(YGNodeRef node);
void YGNodeSetHasNewLayout(YGNodeRef node, bool hasNewLayout);
WIN_EXPORT bool YGNodeGetHasNewLayout(YGNodeRef node);
WIN_EXPORT void YGNodeSetHasNewLayout(YGNodeRef node, bool hasNewLayout);
YGNodeType YGNodeGetNodeType(YGNodeRef node);
void YGNodeSetNodeType(YGNodeRef node, YGNodeType nodeType);
bool YGNodeIsDirty(YGNodeRef node);
WIN_EXPORT bool YGNodeIsDirty(YGNodeRef node);
bool YGNodeLayoutGetDidUseLegacyFlag(const YGNodeRef node);

WIN_EXPORT void YGNodeStyleSetDirection(
Expand Down Expand Up @@ -227,8 +227,8 @@ WIN_EXPORT void YGNodeStyleSetPositionPercent(
const YGNodeRef node,
const YGEdge edge,
const float position);
WIN_EXPORT WIN_STRUCT(YGValue)
YGNodeStyleGetPosition(const YGNodeRef node, const YGEdge edge);
WIN_EXPORT YGValue
YGNodeStyleGetPosition(const YGNodeRef node, const YGEdge edge);

WIN_EXPORT void YGNodeStyleSetMargin(
const YGNodeRef node,
Expand Down

0 comments on commit dfcbf97

Please sign in to comment.