Skip to content

Commit e7dd6ee

Browse files
rectified95Igor Klemenski
andauthored
Update project config to enable autolinking on Windows. (callstack#257)
* Update project config to enable autolinking on Windows. * Fix RNW version in package.json to pull in Folly fix. Co-authored-by: Igor Klemenski <[email protected]>
1 parent e820fe7 commit e7dd6ee

File tree

6 files changed

+41
-7
lines changed

6 files changed

+41
-7
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ or
1515

1616
If using iOS, install cocoapods: `npx pod-install`
1717

18-
On Windows, [`manually link the module`](#Manual-linking-of-the-module-on-Windows) to your app (autolinking will be released in RNW 63).
19-
You can see the example app's code for an example of how to do it.
18+
On Windows, autolinking is available from version 0.63. On 0.62 you need to [`manually link the module`](#Manual-linking-of-the-module-on-Windows) to your app.
19+
You can see the example app's code for how to do it.
2020

2121

2222
## React Native Compatibility

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"react-dom": "~16.9.0",
1717
"react": "^16.11.0",
1818
"react-native": "^0.62.2",
19-
"react-native-windows": "^0.62.0-0",
19+
"react-native-windows": "^0.62.0",
2020
"react-native-web": "~0.11"
2121
}
2222
}

example/windows/SliderTestWindows.sln

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ EndProject
4545
Global
4646
GlobalSection(SharedMSBuildProjectFiles) = preSolution
4747
..\..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{0cc28589-39e4-4288-b162-97b959f8b843}*SharedItemsImports = 9
48-
..\..\node_modules\react-native-windows\ReactWindowsCore\ReactWindowsCore.vcxitems*{11c084a3-a57c-4296-a679-cac17b603144}*SharedItemsImports = 4
48+
..\..\node_modules\react-native-windows\ReactWindowsCore\ReactWindowsCore-Items.vcxitems*{11c084a3-a57c-4296-a679-cac17b603144}*SharedItemsImports = 4
4949
..\..\node_modules\react-native-windows\Shared\Shared.vcxitems*{2049dbe9-8d13-42c9-ae4b-413ae38fffd0}*SharedItemsImports = 9
5050
..\..\node_modules\react-native-windows\Microsoft.ReactNative.SharedManaged\Microsoft.ReactNative.SharedManaged.projitems*{67a1076f-7790-4203-86ea-4402ccb5e782}*SharedItemsImports = 13
5151
..\..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{685a83ae-36bc-4e9d-bdc6-417ebf168463}*SharedItemsImports = 4
@@ -55,7 +55,6 @@ Global
5555
..\..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{c38970c0-5fbf-4d69-90d8-cbac225ae895}*SharedItemsImports = 9
5656
..\..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{da8b35b3-da00-4b02-bde6-6a397b3fd46b}*SharedItemsImports = 9
5757
..\..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
58-
..\..\node_modules\react-native-windows\JSI\Shared\JSI.Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
5958
..\..\node_modules\react-native-windows\Microsoft.ReactNative.Cxx\Microsoft.ReactNative.Cxx.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
6059
..\..\node_modules\react-native-windows\Mso\Mso.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4
6160
..\..\node_modules\react-native-windows\Shared\Shared.vcxitems*{f7d32bd0-2749-483e-9a0d-1635ef7e3136}*SharedItemsImports = 4

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"peerDependencies": {
2222
"react": "^16.11.0",
2323
"react-native": "^0.62.2",
24-
"react-native-windows": "^0.62.0-0"
24+
"react-native-windows": "^0.62.0"
2525
},
2626
"devDependencies": {
2727
"@babel/cli": "^7.8.4",

src/windows/SliderWindows/SliderWindows.vcxproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
<WindowsTargetPlatformMinVersion>10.0.17134.0</WindowsTargetPlatformMinVersion>
1919
</PropertyGroup>
2020
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
21+
<PropertyGroup Label="ReactNativeWindowsProps">
22+
<ReactNativeWindowsDir Condition="'$(ReactNativeWindowsDir)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(SolutionDir), 'node_modules\react-native-windows\package.json'))\node_modules\react-native-windows\</ReactNativeWindowsDir>
23+
</PropertyGroup>
2124
<ItemGroup Label="ProjectConfigurations">
2225
<ProjectConfiguration Include="Debug|ARM">
2326
<Configuration>Debug</Configuration>
@@ -82,6 +85,9 @@
8285
<ImportGroup Label="PropertySheets">
8386
<Import Project="PropertySheet.props" />
8487
</ImportGroup>
88+
<ImportGroup Label="ReactNativeWindowsPropertySheets">
89+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props')" />
90+
</ImportGroup>
8591
<PropertyGroup Label="UserMacros" />
8692
<PropertyGroup />
8793
<ItemDefinitionGroup>
@@ -162,6 +168,16 @@
162168
</ProjectReference>
163169
</ItemGroup>
164170
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
171+
<ImportGroup Label="ReactNativeWindowsTargets">
172+
<Import Project="$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets" Condition="Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets')" />
173+
</ImportGroup>
174+
<Target Name="EnsureReactNativeWindowsTargets" BeforeTargets="PrepareForBuild">
175+
<PropertyGroup>
176+
<ErrorText>This project references targets in your node_modules\react-native-windows folder that are missing. The missing file is {0}.</ErrorText>
177+
</PropertyGroup>
178+
<Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.props'))" />
179+
<Error Condition="!Exists('$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(ReactNativeWindowsDir)\PropertySheets\External\Microsoft.ReactNative.Uwp.CppLib.targets'))" />
180+
</Target>
165181
<ImportGroup Label="ExtensionTargets">
166182
<Import Project="$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('$(SolutionDir)packages\Microsoft.Windows.CppWinRT.2.0.200316.3\build\native\Microsoft.Windows.CppWinRT.targets')" />
167183
</ImportGroup>

yarn.lock

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2049,7 +2049,7 @@
20492049
prettier "1.16.4"
20502050

20512051
"@react-native-community/slider@./src":
2052-
version "3.0.2"
2052+
version "4.0.0-rc.2"
20532053
dependencies:
20542054
flow-bin "0.113.0"
20552055

@@ -7196,6 +7196,25 @@ react-native-web@~0.11:
71967196
prop-types "^15.6.0"
71977197
react-timer-mixin "^0.13.4"
71987198

7199+
react-native-windows@^0.62.0:
7200+
version "0.62.21"
7201+
resolved "https://registry.yarnpkg.com/react-native-windows/-/react-native-windows-0.62.21.tgz#6d11a859fddf569505a884f2d34116342db00d29"
7202+
integrity sha512-wA/4FD6Hh2MZi3f002s87AMGgFg+YxW9znAfw1dLAaLrMPmy4ERRx2fCKuTkPDMKC/ZjMUTvnj0yKkZofApYsg==
7203+
dependencies:
7204+
"@babel/runtime" "^7.8.4"
7205+
cli-spinners "^2.2.0"
7206+
create-react-class "^15.6.3"
7207+
envinfo "^7.5.0"
7208+
fbjs "^1.0.0"
7209+
glob "^7.1.1"
7210+
ora "^3.4.0"
7211+
prop-types "^15.7.2"
7212+
regenerator-runtime "^0.13.2"
7213+
shelljs "^0.7.8"
7214+
username "^5.1.0"
7215+
uuid "^3.3.2"
7216+
xml-parser "^1.2.1"
7217+
71997218
react-native-windows@^0.62.0-0:
72007219
version "0.62.2"
72017220
resolved "https://registry.yarnpkg.com/react-native-windows/-/react-native-windows-0.62.2.tgz#eae6d9e55116d69c8d8316ec6e52505c760ba1bd"

0 commit comments

Comments
 (0)