diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h index b2213adc50c..890bb99d456 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h +++ b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.h @@ -68,7 +68,8 @@ __attribute__((deprecated( /// The window object, used to render the UViewControllers @property (nonatomic, strong, nonnull) UIWindow *window; -@property (nonatomic, nullable) RCTBridge *bridge; +@property (nonatomic, nullable) RCTBridge *bridge + __attribute__((deprecated("The bridge is deprecated and will be removed when removing the legacy architecture."))); @property (nonatomic, strong, nullable) NSString *moduleName; @property (nonatomic, strong, nullable) NSDictionary *initialProps; @property (nonatomic, strong) RCTReactNativeFactory *reactNativeFactory; @@ -76,7 +77,9 @@ __attribute__((deprecated( /// If `automaticallyLoadReactNativeWindow` is set to `true`, the React Native window will be loaded automatically. @property (nonatomic, assign) BOOL automaticallyLoadReactNativeWindow; -@property (nonatomic, nullable) RCTSurfacePresenterBridgeAdapter *bridgeAdapter; +@property (nonatomic, nullable) RCTSurfacePresenterBridgeAdapter *bridgeAdapter __attribute__(( + deprecated("The bridge adapter is deprecated and will be removed when removing the legacy architecture."))); +; - (RCTRootViewFactory *)rootViewFactory; diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h b/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h index 5fb3af23b4a..c0256a5bbe7 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h +++ b/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h @@ -40,17 +40,20 @@ std::unique_ptr RCTAppSetupDefaultJsExecutor std::unique_ptr RCTAppSetupJsExecutorFactoryForOldArch( RCTBridge *bridge, - const std::shared_ptr &runtimeScheduler); + const std::shared_ptr &runtimeScheduler) + __attribute__((deprecated( + "RCTAppSetupJsExecutorFactoryForOldArch(RCTBridge *, RuntimeScheduler) is deprecated and will be removed when we remove the legacy architecture."))); +; #endif // __cplusplus RCT_EXTERN_C_BEGIN -void RCTAppSetupPrepareApp(UIApplication *application, BOOL turboModuleEnabled); -UIView *RCTAppSetupDefaultRootView( - RCTBridge *bridge, - NSString *moduleName, - NSDictionary *initialProperties, - BOOL fabricEnabled); +void RCTAppSetupPrepareApp(UIApplication *application, BOOL turboModuleEnabled) __attribute__((deprecated( + "RCTAppSetupPrepareApp(UIApplication, BOOL) is deprecated and it's signature will change when we remove the legacy arch"))); +UIView * +RCTAppSetupDefaultRootView(RCTBridge *bridge, NSString *moduleName, NSDictionary *initialProperties, BOOL fabricEnabled) + __attribute__((deprecated( + "RCTAppSetupDefaultRootView(RCTBridge *, NSString *, NSDictionary *, BOOL) is deprecated and it's signature will change when we remove the legacy arch"))); RCT_EXTERN_C_END diff --git a/packages/react-native/Libraries/AppDelegate/RCTArchConfiguratorProtocol.h b/packages/react-native/Libraries/AppDelegate/RCTArchConfiguratorProtocol.h index 98882f0c202..ae3edcc7c14 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTArchConfiguratorProtocol.h +++ b/packages/react-native/Libraries/AppDelegate/RCTArchConfiguratorProtocol.h @@ -10,27 +10,29 @@ NS_ASSUME_NONNULL_BEGIN +__attribute__((deprecated( + "RCTArchConfiguratorProtocol is deprecated and will be removed when we remove the legacy architecture."))); @protocol RCTArchConfiguratorProtocol /// This method controls whether the `turboModules` feature of the New Architecture is turned on or off. /// /// @note: This is required to be rendering on Fabric (i.e. on the New Architecture). /// @return: `true` if the Turbo Native Module are enabled. Otherwise, it returns `false`. -- (BOOL)turboModuleEnabled __attribute__((deprecated("Use RCTIsNewArchEnabled instead"))); +- (BOOL)turboModuleEnabled __attribute__((deprecated("This will be removed in a future version of React Native"))); /// This method controls whether the App will use the Fabric renderer of the New Architecture or not. /// /// @return: `true` if the Fabric Renderer is enabled. Otherwise, it returns `false`. -- (BOOL)fabricEnabled __attribute__((deprecated("Use RCTIsNewArchEnabled instead"))); +- (BOOL)fabricEnabled __attribute__((deprecated("This will be removed in a future version of React Native"))); /// This method controls whether React Native's new initialization layer is enabled. /// /// @return: `true` if the new initialization layer is enabled. Otherwise returns `false`. -- (BOOL)bridgelessEnabled __attribute__((deprecated("Use RCTIsNewArchEnabled instead"))); +- (BOOL)bridgelessEnabled __attribute__((deprecated("This will be removed in a future version of React Native"))); /// This method controls whether React Native uses new Architecture. /// /// @return: `true` if the new architecture is enabled. Otherwise returns `false`. -- (BOOL)newArchEnabled __attribute__((deprecated("Use RCTIsNewArchEnabled instead"))); +- (BOOL)newArchEnabled __attribute__((deprecated("This will be removed in a future version of React Native"))); @end NS_ASSUME_NONNULL_END diff --git a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.h b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.h index 14304a97eb9..a8b2ab8c6e5 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.h +++ b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.h @@ -56,7 +56,10 @@ typedef NS_ENUM(NSInteger, RCTReleaseLevel) { Canary, Experimental, Stable }; * * @returns: a newly created instance of RCTBridge. */ -- (RCTBridge *)createBridgeWithDelegate:(id)delegate launchOptions:(NSDictionary *)launchOptions; +- (RCTBridge *)createBridgeWithDelegate:(id)delegate + launchOptions:(NSDictionary *)launchOptions + __attribute__((deprecated( + "createBridgeWithDelegate:launchOptions: is deprecated and will be removed when removing the legacy architecture."))); /** * It creates a `UIView` starting from a bridge, a module name and a set of initial properties. @@ -72,7 +75,9 @@ typedef NS_ENUM(NSInteger, RCTReleaseLevel) { Canary, Experimental, Stable }; */ - (UIView *)createRootViewWithBridge:(RCTBridge *)bridge moduleName:(NSString *)moduleName - initProps:(NSDictionary *)initProps; + initProps:(NSDictionary *)initProps + __attribute__((deprecated( + "createRootViewWithBridge:moduleName:initProps is deprecated and will be removed when removing the legacy architecture."))); /// This method returns a map of Component Descriptors and Components classes that needs to be registered in the /// new renderer. The Component Descriptor is a string which represent the name used in JS to refer to the native @@ -101,10 +106,13 @@ typedef NS_ENUM(NSInteger, RCTReleaseLevel) { Canary, Experimental, Stable }; initialProperties:(NSDictionary *_Nullable)initialProperties launchOptions:(NSDictionary *_Nullable)launchOptions; -@property (nonatomic, nullable) RCTBridge *bridge; +@property (nonatomic, nullable) RCTBridge *bridge + __attribute__((deprecated("The bridge is deprecated and will be removed when removing the legacy architecture."))); @property (nonatomic, strong, nonnull) RCTRootViewFactory *rootViewFactory; -@property (nonatomic, nullable) RCTSurfacePresenterBridgeAdapter *bridgeAdapter; +@property (nonatomic, nullable) RCTSurfacePresenterBridgeAdapter *bridgeAdapter __attribute__(( + deprecated("The bridgeAdapter is deprecated and will be removed when removing the legacy architecture."))); +; @property (nonatomic, weak) id delegate; diff --git a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h index e0e316660b0..35403dac84a 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h +++ b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h @@ -65,14 +65,15 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc - (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock newArchEnabled:(BOOL)newArchEnabled turboModuleEnabled:(BOOL)turboModuleEnabled - bridgelessEnabled:(BOOL)bridgelessEnabled NS_DESIGNATED_INITIALIZER __deprecated; + bridgelessEnabled:(BOOL)bridgelessEnabled __deprecated; - (instancetype)initWithBundleURL:(NSURL *)bundleURL newArchEnabled:(BOOL)newArchEnabled turboModuleEnabled:(BOOL)turboModuleEnabled bridgelessEnabled:(BOOL)bridgelessEnabled __deprecated; -- (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock newArchEnabled:(BOOL)newArchEnabled; +- (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock + newArchEnabled:(BOOL)newArchEnabled NS_DESIGNATED_INITIALIZER; - (instancetype)initWithBundleURL:(NSURL *)bundleURL newArchEnabled:(BOOL)newArchEnabled; diff --git a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm index 16828dd5d2f..936428a7bb7 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm @@ -38,18 +38,12 @@ - (instancetype)initWithBundleURL:(NSURL *)bundleURL newArchEnabled:(BOOL)newArchEnabled { - return [self initWithBundleURL:bundleURL - newArchEnabled:newArchEnabled - turboModuleEnabled:newArchEnabled - bridgelessEnabled:newArchEnabled]; + return [self initWithBundleURL:bundleURL]; } - (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock newArchEnabled:(BOOL)newArchEnabled { - return [self initWithBundleURLBlock:bundleURLBlock - newArchEnabled:newArchEnabled - turboModuleEnabled:newArchEnabled - bridgelessEnabled:newArchEnabled]; + return [self initWithBundleURLBlock:bundleURLBlock]; } - (instancetype)initWithBundleURL:(NSURL *)bundleURL @@ -57,13 +51,9 @@ turboModuleEnabled:(BOOL)turboModuleEnabled bridgelessEnabled:(BOOL)bridgelessEnabled { - return [self - initWithBundleURLBlock:^{ - return bundleURL; - } - newArchEnabled:newArchEnabled - turboModuleEnabled:turboModuleEnabled - bridgelessEnabled:bridgelessEnabled]; + return [self initWithBundleURLBlock:^{ + return bundleURL; + }]; } - (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock @@ -80,6 +70,24 @@ return self; } +- (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock +{ + if (self = [super init]) { + _bundleURLBlock = bundleURLBlock; + _fabricEnabled = YES; + _turboModuleEnabled = YES; + _bridgelessEnabled = YES; + } + return self; +} + +- (instancetype)initWithBundleURL:(NSURL *)bundleURL +{ + return [self initWithBundleURLBlock:^{ + return bundleURL; + }]; +} + @end @interface RCTRootViewFactory () {