Skip to content

Commit b1758a6

Browse files
authored
fix(windows): declare support for 0.82 (#2739)
1 parent 03b49c8 commit b1758a6

8 files changed

Lines changed: 283 additions & 107 deletions

File tree

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@
109109
"lockfile": {
110110
"noDuplicates": {
111111
"packages": [
112-
"#react-native",
113112
"@babel/core"
114113
]
115114
}

packages/app/example/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
"react": "19.1.4",
2424
"react-native": "^0.81.6",
2525
"react-native-macos": "^0.81.0",
26-
"react-native-safe-area-context": "^5.6.0",
27-
"react-native-windows": "^0.81.0"
26+
"react-native-safe-area-context": "^5.6.0"
2827
},
2928
"devDependencies": {
3029
"@babel/core": "^7.25.2",
@@ -93,7 +92,6 @@
9392
"core-android",
9493
"core-ios",
9594
"core-macos",
96-
"core-windows",
9795
"babel-preset-react-native",
9896
"safe-area"
9997
]

packages/app/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,6 @@
119119
"react": "19.1.4",
120120
"react-native": "^0.81.6",
121121
"react-native-macos": "^0.81.0",
122-
"react-native-windows": "^0.81.0",
123122
"suggestion-bot": "^4.0.0"
124123
},
125124
"peerDependencies": {
@@ -128,7 +127,7 @@
128127
"react": "18.2 - 19.2",
129128
"react-native": "0.76 - 0.85 || >=0.85.0-0 <0.86.0",
130129
"react-native-macos": "^0.0.0-0 || 0.76 - 0.81",
131-
"react-native-windows": "^0.0.0-0 || 0.76 - 0.81"
130+
"react-native-windows": "^0.0.0-0 || 0.76 - 0.82"
132131
},
133132
"peerDependenciesMeta": {
134133
"@callstack/react-native-visionos": {

packages/app/test/helpers.test.mts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import type Mustache from "mustache";
2-
import { equal, fail, notEqual } from "node:assert/strict";
1+
import { equal, fail, ok } from "node:assert/strict";
32
import * as fs from "node:fs";
43
import * as path from "node:path";
54
import { describe, it } from "node:test";
@@ -57,27 +56,24 @@ describe("getPackageVersion()", () => {
5756

5857
describe("requireTransitive()", () => {
5958
it("imports transitive dependencies", () => {
60-
const mustache = requireTransitive<typeof Mustache>([
61-
"react-native-windows",
62-
"@react-native-windows/cli",
63-
"mustache",
64-
]);
65-
notEqual(mustache, null);
66-
equal(typeof mustache.parse, "function");
59+
const chain = [
60+
"react-native",
61+
"@react-native/community-cli-plugin",
62+
"metro",
63+
];
64+
65+
ok(requireTransitive(chain));
6766
});
6867

6968
it("imports transitive dependencies given a start path", () => {
70-
const rnwDir = findNearest("node_modules/react-native-windows");
71-
if (!rnwDir) {
72-
fail("Failed to resolve 'react-native-windows'");
69+
const rnDir = findNearest("node_modules/react-native");
70+
if (!rnDir) {
71+
fail("Failed to resolve 'react-native'");
7372
}
7473

75-
const mustache = requireTransitive<typeof Mustache>(
76-
["@react-native-windows/cli", "mustache"],
77-
fs.realpathSync(rnwDir)
78-
);
79-
notEqual(mustache, null);
80-
equal(typeof mustache.parse, "function");
74+
const chain = ["@react-native/community-cli-plugin", "metro"];
75+
76+
ok(requireTransitive(chain, fs.realpathSync(rnDir)));
8177
});
8278
});
8379

packages/app/windows/Shared/ReactInstance.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#endif // __has_include("AppRegistry.h")
1818
#include "AutolinkedNativeModules.g.h"
1919

20+
#define USE_WEB_DEBUGGER RNW_VERSION_LESS_THAN(0, 82, 0)
21+
2022
using facebook::jsi::Runtime;
2123
using ReactTestApp::ReactInstance;
2224

@@ -40,7 +42,9 @@ namespace
4042
winrt::hstring const kBundlerPort = L"bundlerPort";
4143
winrt::hstring const kUseDirectDebugger = L"useDirectDebugger";
4244
winrt::hstring const kUseFastRefresh = L"useFastRefresh";
45+
#if USE_WEB_DEBUGGER
4346
winrt::hstring const kUseWebDebugger = L"useWebDebugger";
47+
#endif // USE_WEB_DEBUGGER
4448

4549
std::optional<winrt::hstring> GetBundleName(std::optional<winrt::hstring> const &bundleRoot)
4650
{
@@ -171,7 +175,9 @@ void ReactInstance::Reload()
171175
{
172176
auto instanceSettings = reactNativeHost_.InstanceSettings();
173177

178+
#if USE_WEB_DEBUGGER
174179
instanceSettings.UseWebDebugger(UseWebDebugger());
180+
#endif // USE_WEB_DEBUGGER
175181
instanceSettings.UseDirectDebugger(UseDirectDebugger());
176182

177183
auto useFastRefresh = UseFastRefresh();
@@ -249,10 +255,12 @@ bool ReactInstance::UseDirectDebugger() const
249255

250256
void ReactInstance::UseDirectDebugger(bool useDirectDebugger)
251257
{
258+
#if USE_WEB_DEBUGGER
252259
if (useDirectDebugger) {
253260
// Remote debugging is incompatible with direct debugging
254261
StoreLocalSetting(kUseWebDebugger, false);
255262
}
263+
#endif // USE_WEB_DEBUGGER
256264
StoreLocalSetting(kUseDirectDebugger, useDirectDebugger);
257265
Reload();
258266
}
@@ -270,17 +278,23 @@ void ReactInstance::UseFastRefresh(bool useFastRefresh)
270278

271279
bool ReactInstance::UseWebDebugger() const
272280
{
281+
#if USE_WEB_DEBUGGER
273282
return IsWebDebuggerAvailable() && RetrieveLocalSetting(kUseWebDebugger, false);
283+
#else
284+
return false;
285+
#endif // USE_WEB_DEBUGGER
274286
}
275287

276288
void ReactInstance::UseWebDebugger(bool useWebDebugger)
277289
{
290+
#if USE_WEB_DEBUGGER
278291
if (useWebDebugger) {
279292
// Remote debugging is incompatible with direct debugging
280293
StoreLocalSetting(kUseDirectDebugger, false);
281294
}
282295
StoreLocalSetting(kUseWebDebugger, useWebDebugger);
283296
Reload();
297+
#endif // USE_WEB_DEBUGGER
284298
}
285299

286300
winrt::IAsyncOperation<bool> ReactTestApp::IsDevServerRunning()

packages/app/windows/Win32/pch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
// clang-format on
1919

2020
#include <CppWinRTIncludes.h>
21+
#include <VersionMacros.h>
2122

2223
#include <winrt/Microsoft.ReactNative.Composition.h>
2324
#include <winrt/Microsoft.ReactNative.h>

packages/example-windows/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@
1616
},
1717
"dependencies": {
1818
"@react-native-webapis/web-storage": "^0.4.5",
19-
"react": "19.1.4",
20-
"react-native": "^0.81.6",
19+
"react": "19.1.1",
20+
"react-native": "^0.82.0",
2121
"react-native-safe-area-context": "^5.6.0",
22-
"react-native-windows": "^0.81.0"
22+
"react-native-windows": "^0.82.0"
2323
},
2424
"devDependencies": {
2525
"@babel/core": "catalog:",
2626
"@babel/preset-env": "catalog:",
2727
"@react-native-community/cli": "^20.0.0",
2828
"@react-native-community/cli-platform-android": "^20.0.0",
2929
"@react-native-community/cli-platform-ios": "^20.0.0",
30-
"@react-native/babel-preset": "^0.81.0",
31-
"@react-native/metro-config": "^0.81.0",
30+
"@react-native/babel-preset": "^0.82.0",
31+
"@react-native/metro-config": "^0.82.0",
3232
"@rnx-kit/cli": "catalog:",
3333
"@rnx-kit/metro-config": "catalog:",
3434
"@rnx-kit/polyfills": "catalog:",
@@ -67,7 +67,7 @@
6767
],
6868
"alignDeps": {
6969
"requirements": [
70-
"react-native@0.81"
70+
"react-native@0.82"
7171
],
7272
"capabilities": [
7373
"core-windows",

0 commit comments

Comments
 (0)