From 9eb0db5abf4d01b5d3c057c91d99f87bc5a4b295 Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 10 Jul 2026 19:18:04 -0400 Subject: [PATCH] Declare RCTBundleURLProviderAllowPackagerServerAccess unconditionally The function is declared only under RCT_DEV_MENU | RCT_PACKAGER_LOADING_FUNCTIONALITY, so it vanishes in Release and any out-of-tree caller fails with "call to undeclared function" (broke expo/expo Release CI, worked around in expo/expo#47688). Mirror the RCTDevLoadingViewSetEnabled shape: unconditional declaration and definition, every read of the flag stays gated, so builds without packager support get a no-op instead of a compile error. --- packages/react-native/React/Base/RCTBundleURLProvider.h | 6 +++--- packages/react-native/React/Base/RCTBundleURLProvider.mm | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/react-native/React/Base/RCTBundleURLProvider.h b/packages/react-native/React/Base/RCTBundleURLProvider.h index 2d7dc5065374..3b33f9d215f2 100644 --- a/packages/react-native/React/Base/RCTBundleURLProvider.h +++ b/packages/react-native/React/Base/RCTBundleURLProvider.h @@ -14,15 +14,15 @@ RCT_EXTERN NSString *_Nonnull const RCTBundleURLProviderUpdatedNotification; RCT_EXTERN const NSUInteger kRCTBundleURLProviderDefaultPort; -#if RCT_DEV_MENU | RCT_PACKAGER_LOADING_FUNCTIONALITY /** * Allow/disallow accessing the packager server for various runtime scenario. * For instance, if a test run should never access the packager, disable it * by calling this function before initializing React Native (RCTBridge etc). - * By default the access is enabled. + * By default the access is enabled. When packager support is compiled out + * (neither RCT_DEV_MENU nor RCT_PACKAGER_LOADING_FUNCTIONALITY is set), + * calling this function is a no-op. */ RCT_EXTERN void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed); -#endif NS_ASSUME_NONNULL_BEGIN diff --git a/packages/react-native/React/Base/RCTBundleURLProvider.mm b/packages/react-native/React/Base/RCTBundleURLProvider.mm index 808925dd08c5..906012b06b26 100644 --- a/packages/react-native/React/Base/RCTBundleURLProvider.mm +++ b/packages/react-native/React/Base/RCTBundleURLProvider.mm @@ -19,13 +19,14 @@ const NSUInteger kRCTBundleURLProviderDefaultPort = RCT_METRO_PORT; -#if RCT_DEV_MENU | RCT_PACKAGER_LOADING_FUNCTIONALITY +// Declared unconditionally so out-of-tree callers link in every configuration, +// same shape as RCTDevLoadingViewSetEnabled. Reads stay gated below, so this is +// a no-op when packager support is compiled out. static BOOL kRCTAllowPackagerAccess = YES; void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed) { kRCTAllowPackagerAccess = allowed; } -#endif static NSString *const kRCTPackagerSchemeKey = @"RCT_packager_scheme"; static NSString *const kRCTJsLocationKey = @"RCT_jsLocation"; static NSString *const kRCTEnableDevKey = @"RCT_enableDev";