mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add deprecation for legacy arch APIs (#53368)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/53368 This change introduces deprecation messages for several APIs used by the legacy arch in the RCTAppDelegate Library ## Changelog: [iOS][Added] - Add deprecation message for RCTAppdelegate APIs Reviewed By: cortinico Differential Revision: D80618102 fbshipit-source-id: db77f8602a521557ed26822f27d54c6fc70c49bf
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e723ca4d6b
commit
d503ea4efc
@@ -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;
|
||||
|
||||
|
||||
@@ -40,17 +40,20 @@ std::unique_ptr<facebook::react::JSExecutorFactory> RCTAppSetupDefaultJsExecutor
|
||||
|
||||
std::unique_ptr<facebook::react::JSExecutorFactory> RCTAppSetupJsExecutorFactoryForOldArch(
|
||||
RCTBridge *bridge,
|
||||
const std::shared_ptr<facebook::react::RuntimeScheduler> &runtimeScheduler);
|
||||
const std::shared_ptr<facebook::react::RuntimeScheduler> &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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -56,7 +56,10 @@ typedef NS_ENUM(NSInteger, RCTReleaseLevel) { Canary, Experimental, Stable };
|
||||
*
|
||||
* @returns: a newly created instance of RCTBridge.
|
||||
*/
|
||||
- (RCTBridge *)createBridgeWithDelegate:(id<RCTBridgeDelegate>)delegate launchOptions:(NSDictionary *)launchOptions;
|
||||
- (RCTBridge *)createBridgeWithDelegate:(id<RCTBridgeDelegate>)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<RCTReactNativeFactoryDelegate> delegate;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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 () <RCTCxxBridgeDelegate> {
|
||||
|
||||
Reference in New Issue
Block a user