Skip to content

Commit ad86cf8

Browse files
committed
Adds fixes for react-native-windows UWP
Specifically, updates the UWP .vcxproj for MSBuild and also exposes the UseLegacyStretchBehaviour API for use with react-native-windows.
1 parent 02a2309 commit ad86cf8

5 files changed

Lines changed: 100 additions & 31 deletions

File tree

csharp/Facebook.Yoga/Native.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ public static extern void YGConfigSetUseWebDefaults(
7474
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
7575
public static extern bool YGConfigGetUseWebDefaults(YGConfigHandle config);
7676

77+
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
78+
public static extern void YGConfigSetUseLegacyStretchBehaviour(
79+
YGConfigHandle config,
80+
bool useLegacyStretchBehavior);
81+
82+
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
83+
public static extern bool YGConfigGetUseLegacyStretchBehaviour(YGConfigHandle config);
84+
7785
[DllImport(DllName, ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
7886
public static extern void YGConfigSetPointScaleFactor(
7987
YGConfigHandle config,

csharp/Facebook.Yoga/YogaConfig.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/**
22
* Copyright (c) Facebook, Inc. and its affiliates.
33
*
44
* This source code is licensed under the MIT license found in the
@@ -117,6 +117,19 @@ public bool UseWebDefaults
117117
}
118118
}
119119

120+
public bool UseLegacyStretchBehaviour
121+
{
122+
get
123+
{
124+
return Native.YGConfigGetUseLegacyStretchBehaviour(_ygConfig);
125+
}
126+
127+
set
128+
{
129+
Native.YGConfigSetUseLegacyStretchBehaviour(_ygConfig, value);
130+
}
131+
}
132+
120133
public float PointScaleFactor
121134
{
122135
set

csharp/Yoga/Yoga.Universal.vcxproj

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
44
<ProjectConfiguration Include="Debug|ARM">
@@ -33,47 +33,47 @@
3333
<RootNamespace>Yoga</RootNamespace>
3434
<AppContainerApplication>true</AppContainerApplication>
3535
<ApplicationType>Windows Store</ApplicationType>
36-
<WindowsTargetPlatformVersion>10.0.10586.0</WindowsTargetPlatformVersion>
37-
<WindowsTargetPlatformMinVersion>10.0.10240.0</WindowsTargetPlatformMinVersion>
36+
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
37+
<WindowsTargetPlatformMinVersion>10.0.14393.0</WindowsTargetPlatformMinVersion>
3838
<ApplicationTypeRevision>10.0</ApplicationTypeRevision>
3939
</PropertyGroup>
4040
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
4141
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
4242
<ConfigurationType>DynamicLibrary</ConfigurationType>
4343
<UseDebugLibraries>true</UseDebugLibraries>
44-
<PlatformToolset>v140</PlatformToolset>
44+
<PlatformToolset>v141</PlatformToolset>
4545
<CharacterSet>Unicode</CharacterSet>
4646
</PropertyGroup>
4747
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
4848
<ConfigurationType>DynamicLibrary</ConfigurationType>
4949
<UseDebugLibraries>true</UseDebugLibraries>
50-
<PlatformToolset>v140</PlatformToolset>
50+
<PlatformToolset>v141</PlatformToolset>
5151
<CharacterSet>Unicode</CharacterSet>
5252
</PropertyGroup>
5353
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
5454
<ConfigurationType>DynamicLibrary</ConfigurationType>
5555
<UseDebugLibraries>false</UseDebugLibraries>
56-
<PlatformToolset>v140</PlatformToolset>
56+
<PlatformToolset>v141</PlatformToolset>
5757
<WholeProgramOptimization>true</WholeProgramOptimization>
5858
<CharacterSet>Unicode</CharacterSet>
5959
</PropertyGroup>
6060
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM'" Label="Configuration">
6161
<ConfigurationType>DynamicLibrary</ConfigurationType>
6262
<UseDebugLibraries>false</UseDebugLibraries>
63-
<PlatformToolset>v140</PlatformToolset>
63+
<PlatformToolset>v141</PlatformToolset>
6464
<WholeProgramOptimization>true</WholeProgramOptimization>
6565
<CharacterSet>Unicode</CharacterSet>
6666
</PropertyGroup>
6767
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
6868
<ConfigurationType>DynamicLibrary</ConfigurationType>
6969
<UseDebugLibraries>true</UseDebugLibraries>
70-
<PlatformToolset>v140</PlatformToolset>
70+
<PlatformToolset>v141</PlatformToolset>
7171
<CharacterSet>Unicode</CharacterSet>
7272
</PropertyGroup>
7373
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
7474
<ConfigurationType>DynamicLibrary</ConfigurationType>
7575
<UseDebugLibraries>false</UseDebugLibraries>
76-
<PlatformToolset>v140</PlatformToolset>
76+
<PlatformToolset>v141</PlatformToolset>
7777
<WholeProgramOptimization>true</WholeProgramOptimization>
7878
<CharacterSet>Unicode</CharacterSet>
7979
</PropertyGroup>
@@ -116,7 +116,7 @@
116116
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
117117
<LinkIncremental>true</LinkIncremental>
118118
<OutDir>bin\Universal\$(PlatformTarget)\$(Configuration)\</OutDir>
119-
<IntDir>obj\$(PlatformTarget)\$(Configuration)\</IntDir>
119+
<IntDir>obj\Universal\$(PlatformTarget)\$(Configuration)\</IntDir>
120120
<TargetName>yoga</TargetName>
121121
</PropertyGroup>
122122
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -242,19 +242,31 @@
242242
</Link>
243243
</ItemDefinitionGroup>
244244
<ItemGroup>
245+
<ClInclude Include="..\..\yoga\Utils.h" />
246+
<ClInclude Include="..\..\yoga\YGConfig.h" />
245247
<ClInclude Include="..\..\yoga\YGEnums.h" />
246-
<ClInclude Include="..\..\yoga\Yoga.h" />
248+
<ClInclude Include="..\..\yoga\YGFloatOptional.h" />
249+
<ClInclude Include="..\..\yoga\YGLayout.h" />
247250
<ClInclude Include="..\..\yoga\YGMacros.h" />
248-
<ClInclude Include="..\..\yoga\YGNodeList.h" />
251+
<ClInclude Include="..\..\yoga\YGNode.h" />
252+
<ClInclude Include="..\..\yoga\YGNodePrint.h" />
253+
<ClInclude Include="..\..\yoga\YGStyle.h" />
254+
<ClInclude Include="..\..\yoga\Yoga-internal.h" />
255+
<ClInclude Include="..\..\yoga\Yoga.h" />
249256
<ClInclude Include="resource.h" />
250-
<ClInclude Include="YGInterop.h" />
251257
<ClInclude Include="stdafx.h" />
252258
<ClInclude Include="targetver.h" />
253259
</ItemGroup>
254260
<ItemGroup>
255-
<ClCompile Include="..\..\yoga\YGEnums.c" />
256-
<ClCompile Include="..\..\yoga\Yoga.c" />
257-
<ClCompile Include="..\..\yoga\YGNodeList.c" />
261+
<ClCompile Include="..\..\yoga\Utils.cpp" />
262+
<ClCompile Include="..\..\yoga\YGConfig.cpp" />
263+
<ClCompile Include="..\..\yoga\YGEnums.cpp" />
264+
<ClCompile Include="..\..\yoga\YGFloatOptional.cpp" />
265+
<ClCompile Include="..\..\yoga\YGLayout.cpp" />
266+
<ClCompile Include="..\..\yoga\YGNode.cpp" />
267+
<ClCompile Include="..\..\yoga\YGNodePrint.cpp" />
268+
<ClCompile Include="..\..\yoga\YGStyle.cpp" />
269+
<ClCompile Include="..\..\yoga\Yoga.cpp" />
258270
<ClCompile Include="YGInterop.cpp" />
259271
<ClCompile Include="dllmain.cpp">
260272
<CompileAsManaged Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</CompileAsManaged>
@@ -284,4 +296,4 @@
284296
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
285297
<ImportGroup Label="ExtensionTargets">
286298
</ImportGroup>
287-
</Project>
299+
</Project>

csharp/Yoga/Yoga.Universal.vcxproj.filters

Lines changed: 46 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,40 @@
2121
<ClInclude Include="targetver.h">
2222
<Filter>Header Files</Filter>
2323
</ClInclude>
24-
<ClInclude Include="..\..\yoga\Yoga.h">
24+
<ClInclude Include="resource.h">
25+
<Filter>Header Files</Filter>
26+
</ClInclude>
27+
<ClInclude Include="..\..\yoga\Utils.h">
28+
<Filter>Header Files</Filter>
29+
</ClInclude>
30+
<ClInclude Include="..\..\yoga\YGEnums.h">
31+
<Filter>Header Files</Filter>
32+
</ClInclude>
33+
<ClInclude Include="..\..\yoga\YGFloatOptional.h">
34+
<Filter>Header Files</Filter>
35+
</ClInclude>
36+
<ClInclude Include="..\..\yoga\YGLayout.h">
2537
<Filter>Header Files</Filter>
2638
</ClInclude>
2739
<ClInclude Include="..\..\yoga\YGMacros.h">
2840
<Filter>Header Files</Filter>
2941
</ClInclude>
30-
<ClInclude Include="..\..\yoga\YGNodeList.h">
42+
<ClInclude Include="..\..\yoga\YGNode.h">
3143
<Filter>Header Files</Filter>
3244
</ClInclude>
33-
<ClInclude Include="YGInterop.h">
45+
<ClInclude Include="..\..\yoga\YGNodePrint.h">
3446
<Filter>Header Files</Filter>
3547
</ClInclude>
36-
<ClInclude Include="resource.h">
48+
<ClInclude Include="..\..\yoga\YGStyle.h">
3749
<Filter>Header Files</Filter>
3850
</ClInclude>
39-
<ClInclude Include="..\..\yoga\YGEnums.h">
51+
<ClInclude Include="..\..\yoga\Yoga.h">
52+
<Filter>Header Files</Filter>
53+
</ClInclude>
54+
<ClInclude Include="..\..\yoga\Yoga-internal.h">
55+
<Filter>Header Files</Filter>
56+
</ClInclude>
57+
<ClInclude Include="..\..\yoga\YGConfig.h">
4058
<Filter>Header Files</Filter>
4159
</ClInclude>
4260
</ItemGroup>
@@ -47,16 +65,34 @@
4765
<ClCompile Include="dllmain.cpp">
4866
<Filter>Source Files</Filter>
4967
</ClCompile>
50-
<ClCompile Include="..\..\yoga\Yoga.c">
68+
<ClCompile Include="YGInterop.cpp">
5169
<Filter>Source Files</Filter>
5270
</ClCompile>
53-
<ClCompile Include="..\..\yoga\YGNodeList.c">
71+
<ClCompile Include="..\..\yoga\Utils.cpp">
5472
<Filter>Source Files</Filter>
5573
</ClCompile>
56-
<ClCompile Include="YGInterop.cpp">
74+
<ClCompile Include="..\..\yoga\YGEnums.cpp">
75+
<Filter>Source Files</Filter>
76+
</ClCompile>
77+
<ClCompile Include="..\..\yoga\YGFloatOptional.cpp">
78+
<Filter>Source Files</Filter>
79+
</ClCompile>
80+
<ClCompile Include="..\..\yoga\YGLayout.cpp">
81+
<Filter>Source Files</Filter>
82+
</ClCompile>
83+
<ClCompile Include="..\..\yoga\YGNode.cpp">
84+
<Filter>Source Files</Filter>
85+
</ClCompile>
86+
<ClCompile Include="..\..\yoga\YGNodePrint.cpp">
87+
<Filter>Source Files</Filter>
88+
</ClCompile>
89+
<ClCompile Include="..\..\yoga\YGStyle.cpp">
90+
<Filter>Source Files</Filter>
91+
</ClCompile>
92+
<ClCompile Include="..\..\yoga\Yoga.cpp">
5793
<Filter>Source Files</Filter>
5894
</ClCompile>
59-
<ClCompile Include="..\..\yoga\YGEnums.c">
95+
<ClCompile Include="..\..\yoga\YGConfig.cpp">
6096
<Filter>Source Files</Filter>
6197
</ClCompile>
6298
</ItemGroup>
@@ -65,4 +101,4 @@
65101
<Filter>Resource Files</Filter>
66102
</ResourceCompile>
67103
</ItemGroup>
68-
</Project>
104+
</Project>

yoga/Yoga.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ YGDirtiedFunc YGNodeGetDirtiedFunc(YGNodeRef node);
174174
void YGNodeSetDirtiedFunc(YGNodeRef node, YGDirtiedFunc dirtiedFunc);
175175
YGPrintFunc YGNodeGetPrintFunc(YGNodeRef node);
176176
void YGNodeSetPrintFunc(YGNodeRef node, YGPrintFunc printFunc);
177-
bool YGNodeGetHasNewLayout(YGNodeRef node);
178-
void YGNodeSetHasNewLayout(YGNodeRef node, bool hasNewLayout);
177+
WIN_EXPORT bool YGNodeGetHasNewLayout(YGNodeRef node);
178+
WIN_EXPORT void YGNodeSetHasNewLayout(YGNodeRef node, bool hasNewLayout);
179179
YGNodeType YGNodeGetNodeType(YGNodeRef node);
180180
void YGNodeSetNodeType(YGNodeRef node, YGNodeType nodeType);
181-
bool YGNodeIsDirty(YGNodeRef node);
181+
WIN_EXPORT bool YGNodeIsDirty(YGNodeRef node);
182182
bool YGNodeLayoutGetDidUseLegacyFlag(const YGNodeRef node);
183183

184184
WIN_EXPORT void YGNodeStyleSetDirection(

0 commit comments

Comments
 (0)