Skip to content

Commit 40684c4

Browse files
authored
[0.75] Fixing unreferenced parameter warnings as errors in Playground-Composition and elsewhere
Backporting PR #14678 to RNW 0.75. ## Description Resolved all warnings which caused build errors in Playground-Composition and RNTesterApp-Fabric. ### Type of Change - Bug fix (non-breaking change which fixes an issue) ### Why Fix build errors in CI and blocking PRs. Resolves #14677 ### What Commented out unreferenced variable names. ## Screenshots N/A ## Testing Verified projects built without warnings in latest VS. ## Changelog Should this change be included in the release notes: _no_
1 parent f851489 commit 40684c4

File tree

8 files changed

+19
-32
lines changed

8 files changed

+19
-32
lines changed

.ado/templates/react-native-init-windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ steps:
6262
workingDirectory: $(Agent.BuildDirectory)
6363
6464
- ${{ if and(endsWith(parameters.template, '-lib'), not(startsWith(parameters.template, 'old'))) }}:
65-
- script: | # Force version 0.42.1, version 0.42.2 is broken, see https://github.com/callstack/react-native-builder-bob/issues/674
66-
npx --yes create-react-native-library@0.42.1 --slug testcli --description testcli --author-name "React-Native-Windows Bot" --author-email [email protected] --author-url http://example.com --repo-url http://example.com --languages kotlin-objc --type module-new --react-native-version $(reactNativeDevDependency) --example vanilla testcli
65+
- script: |
66+
npx --yes create-react-native-library@0.48.9 --slug testcli --description testcli --author-name "React-Native-Windows Bot" --author-email [email protected] --author-url http://example.com --repo-url http://example.com --languages kotlin-objc --type turbo-module --react-native-version $(reactNativeDevDependency) --example vanilla testcli
6767
displayName: Init new lib project with create-react-native-library
6868
workingDirectory: $(Agent.BuildDirectory)
6969

change/@react-native-windows-automation-0671783d-ada6-43fb-9882-81d449c16124.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

change/@react-native-windows-automation-channel-243f361c-0d3e-471e-a30f-bbaec98e4a20.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

change/@react-native-windows-automation-commands-638e11af-371a-497c-8d4a-c794b3f6c67b.json

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "patch",
3+
"comment": "[0.75] Fixing unreferenced parameter warnings as errors in Playground-Composition and elsewhere",
4+
"packageName": "react-native-windows",
5+
"email": "[email protected]",
6+
"dependentChangeType": "patch"
7+
}

packages/e2e-test-app-fabric/windows/RNTesterApp-Fabric/RNTesterApp-Fabric.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ winrt::Microsoft::ReactNative::ReactNativeHost CreateReactNativeHost(
9494
#endif
9595

9696
host.InstanceSettings().InstanceLoaded(
97-
[](auto sender, const winrt::Microsoft::ReactNative::InstanceLoadedEventArgs &args) {
97+
[](auto /*sender*/, const winrt::Microsoft::ReactNative::InstanceLoadedEventArgs &args) {
9898
global_reactContext = args.Context();
9999
});
100100

@@ -167,7 +167,8 @@ _Use_decl_annotations_ int CALLBACK WinMain(HINSTANCE instance, HINSTANCE, PSTR
167167
// Before we shutdown the application - unload the ReactNativeHost to give the javascript a chance to save any
168168
// state
169169
auto async = host.UnloadInstance();
170-
async.Completed([host](auto asyncInfo, winrt::Windows::Foundation::AsyncStatus asyncStatus) {
170+
async.Completed([host](auto /*asyncInfo*/, winrt::Windows::Foundation::AsyncStatus asyncStatus) {
171+
asyncStatus;
171172
assert(asyncStatus == winrt::Windows::Foundation::AsyncStatus::Completed);
172173
host.InstanceSettings().UIDispatcher().Post([]() { PostQuitMessage(0); });
173174
});
@@ -329,7 +330,7 @@ void InsertExpandCollapseStateValueIfNotDefault(
329330
}
330331
}
331332

332-
winrt::Windows::Data::Json::JsonObject ListErrors(winrt::Windows::Data::Json::JsonValue payload) {
333+
winrt::Windows::Data::Json::JsonObject ListErrors(winrt::Windows::Data::Json::JsonValue /*payload*/) {
333334
winrt::Windows::Data::Json::JsonObject result;
334335
winrt::Windows::Data::Json::JsonArray jsonErrors;
335336
winrt::Windows::Data::Json::JsonArray jsonWarnings;

packages/playground/windows/playground-composition/Playground-Composition.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ void RegisterCustomComponent(winrt::Microsoft::ReactNative::IReactPackageBuilder
5151
*/
5252
struct EllipseImageHandler
5353
: winrt::implements<EllipseImageHandler, winrt::Microsoft::ReactNative::Composition::IUriImageProvider> {
54-
bool CanLoadImageUri(winrt::Microsoft::ReactNative::IReactContext context, winrt::Windows::Foundation::Uri uri) {
54+
bool CanLoadImageUri(winrt::Microsoft::ReactNative::IReactContext /*context*/, winrt::Windows::Foundation::Uri uri) {
5555
return uri.SchemeName() == L"ellipse";
5656
}
5757

@@ -115,7 +115,6 @@ winrt::Windows::UI::Composition::Compositor g_compositor{nullptr};
115115
constexpr auto WindowDataProperty = L"WindowData";
116116

117117
int RunPlayground(int showCmd, bool useWebDebugger);
118-
winrt::Microsoft::ReactNative::IReactPackageProvider CreateStubDeviceInfoPackageProvider() noexcept;
119118

120119
struct WindowData {
121120
static HINSTANCE s_instance;
@@ -274,7 +273,7 @@ struct WindowData {
274273
// Disable user sizing of the hwnd
275274
::SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SIZEBOX);
276275
m_compRootView.SizeChanged(
277-
[hwnd](auto sender, const winrt::Microsoft::ReactNative::RootViewSizeChangedEventArgs &args) {
276+
[hwnd](auto /*sender*/, const winrt::Microsoft::ReactNative::RootViewSizeChangedEventArgs &args) {
278277
RECT rcClient, rcWindow;
279278
GetClientRect(hwnd, &rcClient);
280279
GetWindowRect(hwnd, &rcWindow);
@@ -369,7 +368,7 @@ struct WindowData {
369368
case IDM_UNLOAD: {
370369
auto async = Host().UnloadInstance();
371370
async.Completed([&, uidispatch = InstanceSettings().UIDispatcher()](
372-
auto asyncInfo, winrt::Windows::Foundation::AsyncStatus asyncStatus) {
371+
auto /*asyncInfo*/, winrt::Windows::Foundation::AsyncStatus asyncStatus) {
373372
asyncStatus;
374373
OutputDebugStringA("Instance Unload completed\n");
375374

@@ -603,7 +602,8 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam)
603602
L"ReactNative.Composition", L"CompositionContext"});
604603

605604
auto async = data->m_host.UnloadInstance();
606-
async.Completed([host = data->m_host](auto asyncInfo, winrt::Windows::Foundation::AsyncStatus asyncStatus) {
605+
async.Completed([host = data->m_host](auto /*asyncInfo*/, winrt::Windows::Foundation::AsyncStatus asyncStatus) {
606+
asyncStatus;
607607
assert(asyncStatus == winrt::Windows::Foundation::AsyncStatus::Completed);
608608
host.InstanceSettings().UIDispatcher().Post([]() { PostQuitMessage(0); });
609609
});

vnext/ReactCommon/TEMP_UntilReactCommonUpdate/react/bridging/CallbackWrapper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class CallbackWrapper : public LongLivedObject {
2929
jsInvoker_(std::move(jsInvoker)) {}
3030

3131
CallbackWrapper(
32-
std::shared_ptr<LongLivedObjectCollection> longLivedObjectCollection,
32+
std::shared_ptr<LongLivedObjectCollection> /*longLivedObjectCollection*/, // [Windows]
3333
jsi::Function &&callback,
3434
jsi::Runtime &runtime,
3535
std::shared_ptr<CallInvoker> jsInvoker)

0 commit comments

Comments
 (0)