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,9 @@
*/

#import "RCTDefaultReactNativeFactoryDelegate.h"
#import <React/RCTBridge.h>
#import <React/RCTJavaScriptLoader.h>
#import <React/RCTRootView.h>
#import <ReactCommon/RCTHost.h>
#import "RCTAppSetupUtils.h"
#import "RCTDependencyProvider.h"
Expand Down Expand Up @@ -54,10 +57,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
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
92 changes: 6 additions & 86 deletions packages/react-native/React/Base/RCTBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,45 +96,6 @@ RCT_EXTERN_C_END
*/
@interface RCTBridge : NSObject <RCTInvalidating>

/**
* Creates a new bridge with a custom RCTBridgeDelegate.
*
* All the interaction with the JavaScript context should be done using the bridge
* instance of the RCTBridgeModules. Modules will be automatically instantiated
* using the default constructor, but you can optionally pass in an array of
* pre-initialized module instances if they require additional init parameters
* or configuration.
*/
- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)delegate
launchOptions:(NSDictionary *)launchOptions
__deprecated_msg("This API will be removed along with the legacy architecture.");

/**
* DEPRECATED: Use initWithDelegate:launchOptions: instead
*
* The designated initializer. This creates a new bridge on top of the specified
* executor. The bridge should then be used for all subsequent communication
* with the JavaScript code running in the executor. Modules will be automatically
* instantiated using the default constructor, but you can optionally pass in an
* array of pre-initialized module instances if they require additional init
* parameters or configuration.
*/
- (instancetype)initWithBundleURL:(NSURL *)bundleURL
moduleProvider:(RCTBridgeModuleListProvider)block
launchOptions:(NSDictionary *)launchOptions
__deprecated_msg("This API will be removed along with the legacy architecture.");

/**
* This method is used to call functions in the JavaScript application context.
* It is primarily intended for use by modules that require two-way communication
* with the JavaScript code. Safe to call from any thread.
*/
- (void)enqueueJSCall:(NSString *)moduleDotMethod args:(NSArray *)args;
- (void)enqueueJSCall:(NSString *)module
method:(NSString *)method
args:(NSArray *)args
completion:(dispatch_block_t)completion;

/**
* This method registers the file path of an additional JS segment by its ID.
*
Expand All @@ -159,50 +120,29 @@ RCT_EXTERN_C_END
* When a NativeModule performs a lookup for a TurboModule, we need to query
* the TurboModuleRegistry.
*/
- (void)setRCTTurboModuleRegistry:(id<RCTTurboModuleRegistry>)turboModuleRegistry;
- (void)setRCTTurboModuleRegistry:(id<RCTTurboModuleRegistry>)turboModuleRegistry
__deprecated_msg("This API will be removed along with the legacy architecture.");

/**
* This hook is called by the TurboModule infra with every ObjC module that's created.
* It allows the bridge to attach properties to ObjC modules that give those modules
* access to Bridge APIs.
*/
- (RCTBridgeModuleDecorator *)bridgeModuleDecorator;

/**
* Convenience method for retrieving all modules conforming to a given protocol.
* Modules will be synchronously instantiated if they haven't already been,
* potentially blocking both the calling thread and main thread for a short time.
*/
- (NSArray *)modulesConformingToProtocol:(Protocol *)protocol;

/**
* Test if a module has been initialized. Use this prior to calling
* `moduleForClass:` or `moduleForName:` if you do not want to cause the module
* to be instantiated if it hasn't been already.
*/
- (BOOL)moduleIsInitialized:(Class)moduleClass;

/**
* All registered bridge module classes.
*/
@property (nonatomic, copy, readonly) NSArray<Class> *moduleClasses;
- (RCTBridgeModuleDecorator *)
bridgeModuleDecorator __deprecated_msg("This API will be removed along with the legacy architecture.");

/**
* URL of the script that was loaded into the bridge.
*/
@property (nonatomic, strong, readonly) NSURL *bundleURL;
@property (nonatomic, strong, readonly)
NSURL *bundleURL __deprecated_msg("This API will be removed along with the legacy architecture.");

/**
* The class of the executor currently being used. Changes to this value will
* take effect after the bridge is reloaded.
*/
@property (nonatomic, strong) Class executorClass;

/**
* The delegate provided during the bridge initialization
*/
@property (nonatomic, weak, readonly) id<RCTBridgeDelegate> delegate;

/**
* The launch options that were used to initialize the bridge.
*/
Expand All @@ -223,29 +163,9 @@ RCT_EXTERN_C_END
*/
@property (nonatomic, readonly, strong) RCTPerformanceLogger *performanceLogger;

/**
* Reload the bundle and reset executor & modules. Safe to call from any thread.
*/
- (void)reload __deprecated_msg("Use RCTReloadCommand instead");

/**
* Reload the bundle and reset executor & modules. Safe to call from any thread.
*/
- (void)reloadWithReason:(NSString *)reason __deprecated_msg("Use RCTReloadCommand instead");

/**
* Handle notifications for a fast refresh. Safe to call from any thread.
*/
- (void)onFastRefresh;

/**
* Inform the bridge, and anything subscribing to it, that it should reload.
*/
- (void)requestReload __deprecated_msg("Use RCTReloadCommand instead");

/**
* Says whether bridge has started receiving calls from JavaScript.
*/
- (BOOL)isBatchActive;

@end
51 changes: 0 additions & 51 deletions packages/react-native/React/Base/RCTBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#import "RCTInspectorUtils.h"
#import "RCTJSThread.h"
#import "RCTLog.h"
#import "RCTModuleData.h"
#import "RCTPausedInDebuggerOverlayController.h"
#import "RCTPerformanceLogger.h"
#import "RCTReloadCommand.h"
Expand Down Expand Up @@ -241,29 +240,6 @@ void RCTUIManagerSetDispatchAccessibilityManagerInitOntoMain(BOOL enabled)
}

@implementation RCTBridge
- (instancetype)initWithDelegate:(id<RCTBridgeDelegate>)delegate launchOptions:(NSDictionary *)launchOptions
{
return self;
}

- (instancetype)initWithBundleURL:(NSURL *)bundleURL
moduleProvider:(__strong RCTBridgeModuleListProvider)block
launchOptions:(NSDictionary *)launchOptions
{
return self;
}

- (void)enqueueJSCall:(NSString *)moduleDotMethod args:(NSArray *)args
{
}

- (void)enqueueJSCall:(NSString *)module
method:(NSString *)method
args:(NSArray *)args
completion:(__strong dispatch_block_t)completion
{
}

- (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path
{
}
Expand Down Expand Up @@ -292,37 +268,10 @@ - (RCTBridgeModuleDecorator *)bridgeModuleDecorator
return nil;
}

- (NSArray *)modulesConformingToProtocol:(Protocol *)protocol
{
return @[];
}

- (BOOL)moduleIsInitialized:(Class)moduleClass
{
return NO;
}

- (void)reload __attribute__((deprecated("Use RCTReloadCommand instead")))
{
}

- (void)reloadWithReason:(NSString *)reason __attribute__((deprecated("Use RCTReloadCommand instead")))
{
}

- (void)onFastRefresh
{
}

- (void)requestReload __attribute__((deprecated("Use RCTReloadCommand instead")))
{
}

- (BOOL)isBatchActive
{
return NO;
}

- (void)enqueueCallback:(NSNumber *)cbID args:(NSArray *)args
{
}
Expand Down
Loading
Loading