From 8e1d9a0b750a97edc2294ea75d2bc7473eb632ee Mon Sep 17 00:00:00 2001 From: Kevin Gozali Date: Wed, 3 May 2023 23:23:10 -0700 Subject: [PATCH] iOS: deprecate undocumented RCT_ENABLE_LOADING_VIEW, replacing it with RCT_DEV_MENU (#37213) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37213 `RCT_ENABLE_LOADING_VIEW` was added a long time ago with some internal-only use cases that no longer exist today. To avoid confusion, let's deprecate this flag, and re-use RCT_DEV_MENU, which was actually designed for similar dev workflow use cases. Changelog: [Internal] Reviewed By: philIip Differential Revision: D45509523 fbshipit-source-id: 3d73929ec6811496d26a24f24e8741b43ccbc100 --- .../react-native/React/CoreModules/RCTDevLoadingView.mm | 2 +- packages/react-native/React/CxxBridge/RCTCxxBridge.mm | 8 ++++---- .../React/DevSupport/RCTDevLoadingViewSetEnabled.m | 2 +- .../react/bridgeless/platform/ios/Core/RCTInstance.mm | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/react-native/React/CoreModules/RCTDevLoadingView.mm b/packages/react-native/React/CoreModules/RCTDevLoadingView.mm index 8ad0fc0d327..19ccd0398f5 100644 --- a/packages/react-native/React/CoreModules/RCTDevLoadingView.mm +++ b/packages/react-native/React/CoreModules/RCTDevLoadingView.mm @@ -25,7 +25,7 @@ using namespace facebook::react; @interface RCTDevLoadingView () @end -#if RCT_DEV | RCT_ENABLE_LOADING_VIEW +#if RCT_DEV_MENU @implementation RCTDevLoadingView { UIWindow *_window; diff --git a/packages/react-native/React/CxxBridge/RCTCxxBridge.mm b/packages/react-native/React/CxxBridge/RCTCxxBridge.mm index 45c29a24fc9..0f88507ce24 100644 --- a/packages/react-native/React/CxxBridge/RCTCxxBridge.mm +++ b/packages/react-native/React/CxxBridge/RCTCxxBridge.mm @@ -64,7 +64,7 @@ #import #endif -#if (RCT_DEV | RCT_ENABLE_LOADING_VIEW) && __has_include() +#if RCT_DEV_MENU && __has_include() #import #endif @@ -476,7 +476,7 @@ struct RCTInstanceCallback : public InstanceCallback { dispatch_group_enter(prepareBridge); __block NSData *sourceCode; -#if (RCT_DEV | RCT_ENABLE_LOADING_VIEW) && __has_include() +#if RCT_DEV_MENU && __has_include() { id loadingView = [self moduleForName:@"DevLoadingView" lazilyLoadIfNecessary:YES]; [loadingView showWithURL:self.bundleURL]; @@ -493,7 +493,7 @@ struct RCTInstanceCallback : public InstanceCallback { dispatch_group_leave(prepareBridge); } onProgress:^(RCTLoadingProgress *progressData) { -#if (RCT_DEV | RCT_ENABLE_LOADING_VIEW) && __has_include() +#if RCT_DEV_MENU && __has_include() id loadingView = [weakSelf moduleForName:@"DevLoadingView" lazilyLoadIfNecessary:YES]; [loadingView updateProgress:progressData]; @@ -1092,7 +1092,7 @@ struct RCTInstanceCallback : public InstanceCallback { __weak __typeof(self) weakSelf = self; [RCTJavaScriptLoader loadBundleAtURL:bundleURL onProgress:^(RCTLoadingProgress *progressData) { -#if (RCT_DEV_MENU | RCT_ENABLE_LOADING_VIEW) && __has_include() +#if (RCT_DEV_MENU | RCT_DEV_MENU) && __has_include() id loadingView = [weakSelf moduleForName:@"DevLoadingView" lazilyLoadIfNecessary:YES]; [loadingView updateProgress:progressData]; diff --git a/packages/react-native/React/DevSupport/RCTDevLoadingViewSetEnabled.m b/packages/react-native/React/DevSupport/RCTDevLoadingViewSetEnabled.m index 66361cfdd9b..9c121db16e2 100644 --- a/packages/react-native/React/DevSupport/RCTDevLoadingViewSetEnabled.m +++ b/packages/react-native/React/DevSupport/RCTDevLoadingViewSetEnabled.m @@ -7,7 +7,7 @@ #import "RCTDevLoadingViewSetEnabled.h" -#if RCT_DEV | RCT_ENABLE_LOADING_VIEW +#if RCT_DEV_MENU static BOOL isDevLoadingViewEnabled = YES; #else static BOOL isDevLoadingViewEnabled = NO; diff --git a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.mm b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.mm index 9a4c899c570..4d4e5acde1e 100644 --- a/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.mm +++ b/packages/react-native/ReactCommon/react/bridgeless/platform/ios/Core/RCTInstance.mm @@ -38,7 +38,7 @@ #import "RCTJSThreadManager.h" #import "RCTPerformanceLoggerUtils.h" -#if (RCT_DEV | RCT_ENABLE_LOADING_VIEW) && __has_include() +#if RCT_DEV_MENU && __has_include() #import #import #endif @@ -319,7 +319,7 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags) - (void)loadJSBundle:(NSURL *)sourceURL FB_OBJC_DIRECT { -#if (RCT_DEV | RCT_ENABLE_LOADING_VIEW) && __has_include() +#if RCT_DEV_MENU && __has_include() { id loadingView = (id)[_turboModuleManager moduleForName:"DevLoadingView"]; @@ -335,7 +335,7 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags) return; } -#if (RCT_DEV | RCT_ENABLE_LOADING_VIEW) && __has_include() +#if RCT_DEV_MENU && __has_include() id loadingView = (id)[strongSelf->_turboModuleManager moduleForName:"DevLoadingView"]; [loadingView updateProgress:progressData];