Skip to content

Commit e6ae811

Browse files
committed
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.
1 parent e979b0e commit e6ae811

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

packages/react-native/React/Base/RCTBundleURLProvider.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
RCT_EXTERN NSString *_Nonnull const RCTBundleURLProviderUpdatedNotification;
1515
RCT_EXTERN const NSUInteger kRCTBundleURLProviderDefaultPort;
1616

17-
#if RCT_DEV_MENU | RCT_PACKAGER_LOADING_FUNCTIONALITY
1817
/**
1918
* Allow/disallow accessing the packager server for various runtime scenario.
2019
* For instance, if a test run should never access the packager, disable it
2120
* by calling this function before initializing React Native (RCTBridge etc).
22-
* By default the access is enabled.
21+
* By default the access is enabled. When packager support is compiled out
22+
* (neither RCT_DEV_MENU nor RCT_PACKAGER_LOADING_FUNCTIONALITY is set),
23+
* calling this function is a no-op.
2324
*/
2425
RCT_EXTERN void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed);
25-
#endif
2626

2727
NS_ASSUME_NONNULL_BEGIN
2828

packages/react-native/React/Base/RCTBundleURLProvider.mm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@
1919

2020
const NSUInteger kRCTBundleURLProviderDefaultPort = RCT_METRO_PORT;
2121

22-
#if RCT_DEV_MENU | RCT_PACKAGER_LOADING_FUNCTIONALITY
22+
// Declared unconditionally so out-of-tree callers link in every configuration,
23+
// same shape as RCTDevLoadingViewSetEnabled. Reads stay gated below, so this is
24+
// a no-op when packager support is compiled out.
2325
static BOOL kRCTAllowPackagerAccess = YES;
2426
void RCTBundleURLProviderAllowPackagerServerAccess(BOOL allowed)
2527
{
2628
kRCTAllowPackagerAccess = allowed;
2729
}
28-
#endif
2930
static NSString *const kRCTPackagerSchemeKey = @"RCT_packager_scheme";
3031
static NSString *const kRCTJsLocationKey = @"RCT_jsLocation";
3132
static NSString *const kRCTEnableDevKey = @"RCT_enableDev";

0 commit comments

Comments
 (0)