Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,21 @@
*/

#import <Foundation/Foundation.h>
#import <React/RCTBridge.h>
#import <React/RCTRootView.h>

#ifdef __cplusplus
@class RCTBridge;
@class RCTRootView;

#import <memory>
#ifdef __cplusplus

#import <ReactCommon/RCTTurboModuleManager.h>

@protocol RCTDependencyProvider;

// Forward declaration to decrease compilation coupling
namespace facebook::react {
class JSExecutorFactory;
class RuntimeScheduler;
} // namespace facebook::react
RCT_EXTERN NSArray<NSString *> *RCTAppSetupUnstableModulesRequiringMainQueueSetup(
id<RCTDependencyProvider> dependencyProvider);

RCT_EXTERN id<RCTTurboModule> RCTAppSetupDefaultModuleFromClass(
Class moduleClass,
id<RCTDependencyProvider> dependencyProvider);

std::unique_ptr<facebook::react::JSExecutorFactory> RCTAppSetupDefaultJsExecutorFactory(
RCTBridge *bridge,
RCTTurboModuleManager *turboModuleManager,
const std::shared_ptr<facebook::react::RuntimeScheduler> &runtimeScheduler);

#endif // __cplusplus
12 changes: 0 additions & 12 deletions packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@

#import "RCTAppSetupUtils.h"

#import <cxxreact/JSExecutor.h>
#import <react/renderer/runtimescheduler/RuntimeScheduler.h>
#import <react/renderer/runtimescheduler/RuntimeSchedulerBinding.h>

// Turbo Module
#import <React/RCTBundleAssetImageLoader.h>
#import <React/RCTDataRequestHandler.h>
Expand Down Expand Up @@ -92,11 +88,3 @@
// No custom initializer here.
return [moduleClass new];
}

std::unique_ptr<facebook::react::JSExecutorFactory> RCTAppSetupDefaultJsExecutorFactory(
RCTBridge *bridge,
RCTTurboModuleManager *turboModuleManager,
const std::shared_ptr<facebook::react::RuntimeScheduler> &runtimeScheduler)
{
return nullptr;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

#import "RCTDefaultReactNativeFactoryDelegate.h"
#import <React/RCTRootView.h>
#import <ReactCommon/RCTHost.h>
#import "RCTAppSetupUtils.h"
#import "RCTDependencyProvider.h"
Expand All @@ -26,13 +27,6 @@ @implementation RCTDefaultReactNativeFactoryDelegate {

@synthesize dependencyProvider;

- (NSURL *_Nullable)sourceURLForBridge:(nonnull RCTBridge *)bridge
{
[NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented"
format:@"Subclasses must implement a valid sourceURLForBridge method"];
return nil;
}

- (UIViewController *)createRootViewController
{
return [UIViewController new];
Expand All @@ -54,10 +48,13 @@ - (JSRuntimeFactoryRef)createJSRuntimeFactory
#endif
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (void)customizeRootView:(RCTRootView *)rootView
{
// Override point for customization after application launch.
}
#pragma clang diagnostic pop

- (RCTColorSpace)defaultColorSpace
{
Expand Down Expand Up @@ -111,11 +108,6 @@ - (void)hostDidStart:(RCTHost *)host

#pragma mark - RCTArchConfiguratorProtocol

- (BOOL)newArchEnabled
{
return YES;
}

- (Class)getModuleClassFromName:(const char *)name
{
return nullptr;
Expand All @@ -126,11 +118,4 @@ - (Class)getModuleClassFromName:(const char *)name
return nullptr;
}

- (void)loadSourceForBridge:(RCTBridge *)bridge
onProgress:(RCTSourceLoadProgressBlock)onProgress
onComplete:(RCTSourceLoadBlock)loadCallback
{
[RCTJavaScriptLoader loadBundleAtURL:[self sourceURLForBridge:bridge] onProgress:onProgress onComplete:loadCallback];
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -289,24 +289,12 @@ - (RCTRootViewFactory *)createRCTRootViewFactory
};

RCTRootViewFactoryConfiguration *configuration =
[[RCTRootViewFactoryConfiguration alloc] initWithBundleURLBlock:bundleUrlBlock newArchEnabled:YES];
[[RCTRootViewFactoryConfiguration alloc] initWithBundleURLBlock:bundleUrlBlock];

configuration.customizeRootView = ^(UIView *_Nonnull rootView) {
[weakSelf.delegate customizeRootView:(RCTRootView *)rootView];
};

configuration.sourceURLForBridge = ^NSURL *_Nullable(RCTBridge *_Nonnull bridge)
{
return [weakSelf.delegate bundleURL];
};

if ([self.delegate respondsToSelector:@selector(extraModulesForBridge:)]) {
configuration.extraModulesForBridge = ^NSArray<id<RCTBridgeModule>> *_Nonnull(RCTBridge *_Nonnull bridge)
{
return [weakSelf.delegate extraModulesForBridge:bridge];
};
}

configuration.jsRuntimeConfiguratorDelegate = self;

return [[RCTRootViewFactory alloc] initWithTurboModuleDelegate:self hostDelegate:self configuration:configuration];
Expand Down
40 changes: 24 additions & 16 deletions packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

#import <React/RCTBridge.h>
#import <React/RCTJavaScriptLoader.h>
#import <React/RCTRootView.h>
#import <React/RCTUtils.h>
#import "RCTJSRuntimeConfiguratorProtocol.h"
Expand Down Expand Up @@ -38,7 +39,6 @@ typedef void (^RCTLoadSourceForBridgeWithProgressBlock)(
RCTBridge *bridge,
RCTSourceLoadProgressBlock onProgress,
RCTSourceLoadBlock loadCallback);
typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBlock loadCallback);

#pragma mark - RCTRootViewFactory Configuration
@interface RCTRootViewFactoryConfiguration : NSObject
Expand All @@ -55,10 +55,16 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc
* pointing to a path inside the app resources, e.g. `file://.../main.jsbundle`.
*
*/
- (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock NS_DESIGNATED_INITIALIZER;

- (instancetype)initWithBundleURL:(NSURL *)bundleURL;

- (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock
newArchEnabled:(BOOL)newArchEnabled NS_DESIGNATED_INITIALIZER;
newArchEnabled:(BOOL)newArchEnabled
__deprecated_msg("The flag is ignored; use initWithBundleURLBlock:.");

- (instancetype)initWithBundleURL:(NSURL *)bundleURL newArchEnabled:(BOOL)newArchEnabled;
- (instancetype)initWithBundleURL:(NSURL *)bundleURL
newArchEnabled:(BOOL)newArchEnabled __deprecated_msg("The flag is ignored; use initWithBundleURL:.");

/**
* Block that allows to override logic of creating root view instance.
Expand All @@ -73,7 +79,8 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc
*
* @returns: a UIView properly configured with a bridge for React Native.
*/
@property (nonatomic, nullable) RCTCreateRootViewWithBridgeBlock createRootViewWithBridge;
@property (nonatomic, nullable) RCTCreateRootViewWithBridgeBlock createRootViewWithBridge __deprecated_msg(
"This API will be removed along with the legacy architecture.");

/**
* Block that allows to override default behavior of creating bridge.
Expand All @@ -86,7 +93,8 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc
*
* @returns: a newly created instance of RCTBridge.
*/
@property (nonatomic, nullable) RCTCreateBridgeWithDelegateBlock createBridgeWithDelegate;
@property (nonatomic, nullable) RCTCreateBridgeWithDelegateBlock createBridgeWithDelegate __deprecated_msg(
"This API will be removed along with the legacy architecture.");

/**
* Block that allows to customize the rootView that is passed to React Native.
Expand All @@ -105,7 +113,8 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc
* When running from a locally bundled JS file, this should be a `file://` url
* pointing to a path inside the app resources, e.g. `file://.../main.jsbundle`.
*/
@property (nonatomic, nullable) RCTSourceURLForBridgeBlock sourceURLForBridge;
@property (nonatomic, nullable) RCTSourceURLForBridgeBlock sourceURLForBridge __deprecated_msg(
"This API will be removed along with the legacy architecture.");

/**
* The bridge initializes any registered RCTBridgeModules automatically, however
Expand All @@ -121,12 +130,14 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc
* not recommended in most cases - if the module methods and behavior do not
* match exactly, it may lead to bugs or crashes.
*/
@property (nonatomic, nullable) RCTExtraModulesForBridgeBlock extraModulesForBridge;
@property (nonatomic, nullable) RCTExtraModulesForBridgeBlock extraModulesForBridge __deprecated_msg(
"This API will be removed along with the legacy architecture.");

/**
* Retrieve the list of lazy-native-modules names for the given bridge.
*/
@property (nonatomic, nullable) RCTExtraLazyModuleClassesForBridge extraLazyModuleClassesForBridge;
@property (nonatomic, nullable) RCTExtraLazyModuleClassesForBridge extraLazyModuleClassesForBridge __deprecated_msg(
"This API will be removed along with the legacy architecture.");

/**
* The bridge will call this block when a module has been called from JS
Expand All @@ -135,20 +146,17 @@ typedef void (^RCTLoadSourceForBridgeBlock)(RCTBridge *bridge, RCTSourceLoadBloc
* in the implementation, and the system must attempt to look for it again among registered.
* If the module was not registered, return NO to prevent further searches.
*/
@property (nonatomic, nullable) RCTBridgeDidNotFindModuleBlock bridgeDidNotFindModule;
@property (nonatomic, nullable) RCTBridgeDidNotFindModuleBlock bridgeDidNotFindModule __deprecated_msg(
"This API will be removed along with the legacy architecture.");

/**
* The bridge will automatically attempt to load the JS source code from the
* location specified by the `sourceURLForBridge:` method, however, if you want
* to handle loading the JS yourself, you can do so by setting this property.
*/
@property (nonatomic, nullable) RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress;

/**
* Similar to loadSourceForBridgeWithProgress but without progress
* reporting.
*/
@property (nonatomic, nullable) RCTLoadSourceForBridgeBlock loadSourceForBridge;
@property (nonatomic, nullable)
RCTLoadSourceForBridgeWithProgressBlock loadSourceForBridgeWithProgress __deprecated_msg(
"This API will be removed along with the legacy architecture.");

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,6 @@ - (RCTHost *)createReactHost:(NSDictionary *)launchOptions
reinterpret_cast<facebook::react::JSRuntimeFactory *>(jsRuntimeFactory), &js_runtime_factory_destroy);
}

- (NSArray<id<RCTBridgeModule>> *)extraModulesForBridge:(RCTBridge *)bridge
{
if (_configuration.extraModulesForBridge != nil) {
return _configuration.extraModulesForBridge(bridge);
}
return nil;
}

- (NSURL *)bundleURL
{
return self->_configuration.bundleURLBlock();
Expand Down
30 changes: 0 additions & 30 deletions packages/react-native/React/Base/RCTBridge+Inspector.h

This file was deleted.

5 changes: 3 additions & 2 deletions packages/react-native/React/Base/RCTBridge+Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ RCT_EXTERN void RCTRegisterModule(Class);

@interface RCTBridge ()

+ (instancetype)currentBridge;
+ (void)setCurrentBridge:(RCTBridge *)bridge;
+ (instancetype)currentBridge __deprecated_msg("This API will be removed along with the legacy architecture.");
+ (void)setCurrentBridge:(RCTBridge *)bridge
__deprecated_msg("This API will be removed along with the legacy architecture.");

/**
* This method is used to invoke a callback that was registered in the
Expand Down
Loading
Loading