Skip to content

fix(react-native-host): Various build fixes#4143

Merged
tido64 merged 4 commits into
microsoft:mainfrom
Saadnajmi:fix-wshadow-strongself-rename
May 19, 2026
Merged

fix(react-native-host): Various build fixes#4143
tido64 merged 4 commits into
microsoft:mainfrom
Saadnajmi:fix-wshadow-strongself-rename

Conversation

@Saadnajmi
Copy link
Copy Markdown
Contributor

@Saadnajmi Saadnajmi commented May 10, 2026

Three small build fixes for @rnx-kit/react-native-host cocoa source.

Description

  • Rename inner strongSelf to fix -Wshadow. The inner block in -setBridge: redeclares strongSelf, shadowing the outer strongSelf captured for the RCTExecuteOnMainQueue scope. Rename the inner reference to innerStrongSelf so it no longer shadows the outer.
  • Gate <React/RCTCxxBridgeDelegate.h> behind #if !USE_BRIDGELESS. The protocol conformance is already conditional (<RCTContextContainerHandling> when USE_BRIDGELESS=1, otherwise <RCTCxxBridgeDelegate>), but the import above it is unconditional. Consumers that don't expose RCTCxxBridgeDelegate.h in their USE_BRIDGELESS=1 React-Core surface fail to compile. Gate the import the same way the conformance is gated.
  • Drop stray ; before -viewWithModuleName:initialProperties: body. Flagged by -Wsemicolon-before-method-body; build failure under -Werror.

Test plan

Tested internally where we use stricter xcconfigs.

The inner block in -setBridge: redeclares strongSelf, shadowing the outer
strongSelf captured for the RCTExecuteOnMainQueue scope. With -Wshadow on
this is a -Werror.

Rename the inner reference to innerStrongSelf so it no longer shadows the
outer.
Saadnajmi added 2 commits May 18, 2026 12:27
…_BRIDGELESS

The protocol conformance on ReactNativeHost is already conditional
(`<RCTContextContainerHandling>` when USE_BRIDGELESS=1, otherwise
`<RCTCxxBridgeDelegate>`), but the `#import <React/RCTCxxBridgeDelegate.h>`
above it is unconditional. Consumers that don't expose that header in
their USE_BRIDGELESS=1 React-Core surface fail to compile.

Gate the import the same way the conformance is gated so the header is
only required when it is actually used.
…me: body

The semicolon between the method declarator and the body of
`-viewWithModuleName:initialProperties:` is flagged by
`-Wsemicolon-before-method-body`. With `-Werror` on, this is a build
failure under stricter xcconfigs.
@Saadnajmi Saadnajmi changed the title fix(react-native-host): rename inner strongSelf to fix -Wshadow fix(react-native-host): Various build fixes May 18, 2026
@Saadnajmi Saadnajmi force-pushed the fix-wshadow-strongself-rename branch from 602e266 to d77bba7 Compare May 18, 2026 19:35
@tido64 tido64 merged commit 6171b84 into microsoft:main May 19, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants