Skip to content

Commit dfcbf97

Browse files
rozelefacebook-github-bot
authored andcommitted
Adds fixes for react-native-windows UWP (#848)
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
1 parent c435ff3 commit dfcbf97

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

ReactCommon/yoga/yoga/YGMacros.h

-8
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@
2020
#define WIN_EXPORT
2121
#endif
2222

23-
#ifdef WINARMDLL
24-
#define WIN_STRUCT(type) type*
25-
#define WIN_STRUCT_REF(value) &value
26-
#else
27-
#define WIN_STRUCT(type) type
28-
#define WIN_STRUCT_REF(value) value
29-
#endif
30-
3123
#ifdef NS_ENUM
3224
// Cannot use NSInteger as NSInteger has a different size than int (which is the
3325
// default type of a enum). Therefor when linking the Yoga C library into obj-c

ReactCommon/yoga/yoga/Yoga.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -602,12 +602,12 @@ inline detail::CompactValue Value::create<YGUnitAuto>(float) {
602602
template <YGStyle::Dimensions YGStyle::*P>
603603
struct DimensionProp {
604604
template <YGDimension idx>
605-
static WIN_STRUCT(YGValue) get(YGNodeRef node) {
605+
static YGValue get(YGNodeRef node) {
606606
YGValue value = (node->getStyle().*P)[idx];
607607
if (value.unit == YGUnitUndefined || value.unit == YGUnitAuto) {
608608
value.value = YGUndefined;
609609
}
610-
return WIN_STRUCT_REF(value);
610+
return value;
611611
}
612612

613613
template <YGDimension idx, YGUnit U>
@@ -690,13 +690,12 @@ struct DimensionProp {
690690
} \
691691
} \
692692
\
693-
WIN_STRUCT(type) \
694-
YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge) { \
693+
type YGNodeStyleGet##name(const YGNodeRef node, const YGEdge edge) { \
695694
YGValue value = node->getStyle().instanceName[edge]; \
696695
if (value.unit == YGUnitUndefined || value.unit == YGUnitAuto) { \
697696
value.value = YGUndefined; \
698697
} \
699-
return WIN_STRUCT_REF(value); \
698+
return value; \
700699
}
701700

702701
#define YG_NODE_LAYOUT_PROPERTY_IMPL(type, name, instanceName) \

ReactCommon/yoga/yoga/Yoga.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ YGDirtiedFunc YGNodeGetDirtiedFunc(YGNodeRef node);
140140
void YGNodeSetDirtiedFunc(YGNodeRef node, YGDirtiedFunc dirtiedFunc);
141141
YGPrintFunc YGNodeGetPrintFunc(YGNodeRef node);
142142
void YGNodeSetPrintFunc(YGNodeRef node, YGPrintFunc printFunc);
143-
bool YGNodeGetHasNewLayout(YGNodeRef node);
144-
void YGNodeSetHasNewLayout(YGNodeRef node, bool hasNewLayout);
143+
WIN_EXPORT bool YGNodeGetHasNewLayout(YGNodeRef node);
144+
WIN_EXPORT void YGNodeSetHasNewLayout(YGNodeRef node, bool hasNewLayout);
145145
YGNodeType YGNodeGetNodeType(YGNodeRef node);
146146
void YGNodeSetNodeType(YGNodeRef node, YGNodeType nodeType);
147-
bool YGNodeIsDirty(YGNodeRef node);
147+
WIN_EXPORT bool YGNodeIsDirty(YGNodeRef node);
148148
bool YGNodeLayoutGetDidUseLegacyFlag(const YGNodeRef node);
149149

150150
WIN_EXPORT void YGNodeStyleSetDirection(
@@ -227,8 +227,8 @@ WIN_EXPORT void YGNodeStyleSetPositionPercent(
227227
const YGNodeRef node,
228228
const YGEdge edge,
229229
const float position);
230-
WIN_EXPORT WIN_STRUCT(YGValue)
231-
YGNodeStyleGetPosition(const YGNodeRef node, const YGEdge edge);
230+
WIN_EXPORT YGValue
231+
YGNodeStyleGetPosition(const YGNodeRef node, const YGEdge edge);
232232

233233
WIN_EXPORT void YGNodeStyleSetMargin(
234234
const YGNodeRef node,

0 commit comments

Comments
 (0)