Skip to content
Closed
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
1 change: 0 additions & 1 deletion packages/react-native/Libraries/Blob/RCTBlobManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTInitializing.h>
#import <React/RCTURLRequestHandler.h>
Expand Down
1 change: 0 additions & 1 deletion packages/react-native/Libraries/Blob/RCTBlobManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ @implementation RCTBlobManager {

RCT_EXPORT_MODULE(BlobModule)

@synthesize bridge = _bridge;
@synthesize moduleRegistry = _moduleRegistry;
@synthesize methodQueue = _methodQueue;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#import <React/RCTFileReaderModule.h>

#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import <React/RCTBridge.h>
#import <React/RCTConvert.h>

#import <React/RCTBlobManager.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#import <UIKit/UIKit.h>

#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTImageURLLoader.h>
#import <React/RCTResizeMode.h>
#import <React/RCTURLRequestHandler.h>
Expand Down
19 changes: 4 additions & 15 deletions packages/react-native/Libraries/Image/RCTImageLoader.mm
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ @implementation RCTImageLoader {
__weak id<RCTImageRedirectProtocol> _redirectDelegate;
}

@synthesize bridge = _bridge;
@synthesize moduleRegistry = _moduleRegistry;
@synthesize maxConcurrentLoadingTasks = _maxConcurrentLoadingTasks;
@synthesize maxConcurrentDecodingTasks = _maxConcurrentDecodingTasks;
Expand Down Expand Up @@ -134,13 +133,8 @@ - (void)setUp

_URLRequestQueue = dispatch_queue_create("com.facebook.react.ImageLoaderURLRequestQueue", DISPATCH_QUEUE_SERIAL);

// Get loaders, sorted in reverse priority order (highest priority first)
if (_loadersProvider != nil) {
_loaders = _loadersProvider(self.moduleRegistry);
} else {
RCTAssert(_bridge, @"Trying to find RCTImageURLLoaders and bridge not set.");
_loaders = [_bridge modulesConformingToProtocol:@protocol(RCTImageURLLoader)];
}
RCTAssert(_loadersProvider != nil, @"Trying to find RCTImageURLLoaders and loaders provider not set.");
_loaders = _loadersProvider(self.moduleRegistry);
_loaders =
[_loaders sortedArrayUsingComparator:^NSComparisonResult(id<RCTImageURLLoader> a, id<RCTImageURLLoader> b) {
float priorityA = [a respondsToSelector:@selector(loaderPriority)] ? [a loaderPriority] : 0;
Expand All @@ -154,13 +148,8 @@ - (void)setUp
}
}];

// Get decoders, sorted in reverse priority order (highest priority first)
if (_decodersProvider != nil) {
_decoders = _decodersProvider(self.moduleRegistry);
} else {
RCTAssert(_bridge, @"Trying to find RCTImageDataDecoders and bridge not set.");
_decoders = [_bridge modulesConformingToProtocol:@protocol(RCTImageDataDecoder)];
}
RCTAssert(_decodersProvider != nil, @"Trying to find RCTImageDataDecoders and decoders provider not set.");
_decoders = _decodersProvider(self.moduleRegistry);
_decoders = [_decoders
sortedArrayUsingComparator:^NSComparisonResult(id<RCTImageDataDecoder> a, id<RCTImageDataDecoder> b) {
float priorityA = [a respondsToSelector:@selector(decoderPriority)] ? [a decoderPriority] : 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#import <UIKit/UIKit.h>

#import <React/RCTBridge.h>
#import <React/RCTImageCache.h>
#import <React/RCTImageDataDecoder.h>
#import <React/RCTImageURLLoader.h>
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/Libraries/Image/RCTImageURLLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#import <UIKit/UIKit.h>

#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTResizeMode.h>

NS_ASSUME_NONNULL_BEGIN
Expand Down
5 changes: 2 additions & 3 deletions packages/react-native/Libraries/Network/RCTNetworking.mm
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,8 @@ - (void)invalidate
return _handlers;
}

NSArray<id<RCTURLRequestHandler>> *newHandlers = _handlersProvider
? _handlersProvider(self.moduleRegistry)
: [self.bridge modulesConformingToProtocol:@protocol(RCTURLRequestHandler)];
RCTAssert(_handlersProvider != nil, @"Trying to find RCTURLRequestHandlers and handlers provider not set.");
NSArray<id<RCTURLRequestHandler>> *newHandlers = _handlersProvider(self.moduleRegistry);

// Get handlers, sorted in reverse priority order (highest priority first)
newHandlers = [newHandlers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#import <UserNotifications/UserNotifications.h>

#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import <React/RCTBridge.h>
#import <React/RCTConvert.h>
#import <React/RCTUtils.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#import <React/RCTSettingsManager.h>

#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import <React/RCTBridge.h>
#import <React/RCTConvert.h>
#import <React/RCTEventDispatcherProtocol.h>
#import <React/RCTUtils.h>
Expand Down
20 changes: 20 additions & 0 deletions packages/react-native/React/Base/RCTBridgeModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
@class RCTModuleRegistry;
@class RCTViewRegistry;
@class RCTCallableJSModules;
@class RCTPerformanceLogger;

/**
* The type of a block that is capable of sending a response to a bridged
Expand Down Expand Up @@ -168,6 +169,25 @@ RCT_EXTERN_C_END
*/
@property (nonatomic, weak, readwrite) RCTCallableJSModules *callableJSModules;

/**
* The launch options that were used to initialize the React instance.
* Useful for modules that need to read launch-time configuration.
*
* To implement this in your module, just add `@synthesize launchOptions =
* _launchOptions;`. If using Swift, add `@objc var launchOptions:
* NSDictionary!` to your module.
*/
@property (nonatomic, copy, readwrite) NSDictionary *launchOptions;

/**
* Link to the Performance Logger that logs React Native perf events.
*
* To implement this in your module, just add `@synthesize performanceLogger =
* _performanceLogger;`. If using Swift, add `@objc var performanceLogger:
* RCTPerformanceLogger!` to your module.
*/
@property (nonatomic, strong, readwrite) RCTPerformanceLogger *performanceLogger;

/**
* A reference to the RCTBridge. Useful for modules that require access
* to bridge features, such as sending events or making JS calls. This
Expand Down
7 changes: 6 additions & 1 deletion packages/react-native/React/Base/RCTBridgeModuleDecorator.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
@class RCTBundleManager;
@class RCTCallableJSModules;
@class RCTModuleRegistry;
@class RCTPerformanceLogger;
@class RCTViewRegistry;

/**
Expand All @@ -24,11 +25,15 @@
@property (nonatomic, strong, readonly) RCTModuleRegistry *moduleRegistry;
@property (nonatomic, strong, readonly) RCTBundleManager *bundleManager;
@property (nonatomic, strong, readonly) RCTCallableJSModules *callableJSModules;
@property (nonatomic, copy, readonly) NSDictionary *launchOptions;
@property (nonatomic, strong, readonly) RCTPerformanceLogger *performanceLogger;

- (instancetype)initWithViewRegistry:(RCTViewRegistry *)viewRegistry
moduleRegistry:(RCTModuleRegistry *)moduleRegistry
bundleManager:(RCTBundleManager *)bundleManager
callableJSModules:(RCTCallableJSModules *)callableJSModules;
callableJSModules:(RCTCallableJSModules *)callableJSModules
launchOptions:(NSDictionary *)launchOptions
performanceLogger:(RCTPerformanceLogger *)performanceLogger;

- (void)attachInteropAPIsToModule:(id<RCTBridgeModule>)bridgeModule;

Expand Down
26 changes: 26 additions & 0 deletions packages/react-native/React/Base/RCTBridgeModuleDecorator.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ - (instancetype)initWithViewRegistry:(RCTViewRegistry *)viewRegistry
moduleRegistry:(RCTModuleRegistry *)moduleRegistry
bundleManager:(RCTBundleManager *)bundleManager
callableJSModules:(RCTCallableJSModules *)callableJSModules
launchOptions:(NSDictionary *)launchOptions
performanceLogger:(RCTPerformanceLogger *)performanceLogger
{
if (self = [super init]) {
_viewRegistry_DEPRECATED = viewRegistry;
_moduleRegistry = moduleRegistry;
_bundleManager = bundleManager;
_callableJSModules = callableJSModules;
_launchOptions = [launchOptions copy];
_performanceLogger = performanceLogger;
}
return self;
}
Expand Down Expand Up @@ -68,6 +72,28 @@ - (void)attachInteropAPIsToModule:(id<RCTBridgeModule>)bridgeModule
if ([bridgeModule respondsToSelector:@selector(setModuleRegistry:)]) {
bridgeModule.moduleRegistry = _moduleRegistry;
}

/**
* Attach the launch options to this TurboModule, which allows this TurboModule
* to read the launch-time configuration of the React instance.
*
* Usage: In the TurboModule @implementation, include:
* `@synthesize launchOptions = _launchOptions`
*/
if ([bridgeModule respondsToSelector:@selector(setLaunchOptions:)]) {
bridgeModule.launchOptions = _launchOptions;
}

/**
* Attach the RCTPerformanceLogger to this TurboModule, which allows this
* TurboModule to read React Native perf events.
*
* Usage: In the TurboModule @implementation, include:
* `@synthesize performanceLogger = _performanceLogger`
*/
if ([bridgeModule respondsToSelector:@selector(setPerformanceLogger:)]) {
bridgeModule.performanceLogger = _performanceLogger;
}
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#import <UIKit/UIKit.h>

#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>

@interface RCTActionSheetManager : NSObject <RCTBridgeModule>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#if !TARGET_OS_TV

#import <React/RCTBridge.h>
#import <React/RCTConvert.h>
#import <React/RCTLog.h>
#import <React/RCTUIManager.h>
Expand Down
1 change: 0 additions & 1 deletion packages/react-native/React/CoreModules/RCTAppState.mm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import <React/RCTAssert.h>
#import <React/RCTBridge.h>
#import <React/RCTEventDispatcherProtocol.h>
#import <React/RCTInitializing.h>
#import <React/RCTUtils.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import <React/RCTAppearance.h>
#import <React/RCTBridge.h>
#import <React/RCTConstants.h>
#import <React/RCTConvert.h>
#import <React/RCTDefines.h>
Expand Down
1 change: 0 additions & 1 deletion packages/react-native/React/CoreModules/RCTDevMenu.mm
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ @implementation RCTDevMenu {
NSMutableArray<RCTDevMenuItem *> *_extraMenuItems;
}

@synthesize bridge = _bridge;
@synthesize moduleRegistry = _moduleRegistry;
@synthesize callableJSModules = _callableJSModules;
@synthesize bundleManager = _bundleManager;
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/React/CoreModules/RCTDeviceInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#import <UIKit/UIKit.h>

#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>

@interface RCTDeviceInfo : NSObject <RCTBridgeModule>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#import <UIKit/UIKit.h>

#import <React/RCTBridge.h>
#import <React/RCTEventDispatcherProtocol.h>
#import <React/RCTInitializing.h>
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ @implementation RCTEventDispatcher {
NSRecursiveLock *_observersLock;
}

@synthesize bridge = _bridge;
@synthesize dispatchToJSThread = _dispatchToJSThread;
@synthesize callableJSModules = _callableJSModules;

Expand Down Expand Up @@ -175,13 +174,7 @@ - (void)sendEvent:(id<RCTEvent>)event
[_eventQueueLock unlock];

if (scheduleEventsDispatch) {
if (_bridge != nullptr) {
[_bridge
dispatchBlock:^{
[self flushEventsQueue];
}
queue:RCTJSThread];
} else if (_dispatchToJSThread != nullptr) {
if (_dispatchToJSThread != nullptr) {
_dispatchToJSThread(^{
[self flushEventsQueue];
});
Expand Down
1 change: 1 addition & 0 deletions packages/react-native/React/CoreModules/RCTLogBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

#import <React/RCTDefines.h>
#import <UIKit/UIKit.h>
#import "RCTLogBoxView.h"

Expand Down
4 changes: 1 addition & 3 deletions packages/react-native/React/CoreModules/RCTLogBox.mm
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#import "RCTLogBox.h"

#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTDefines.h>
#import <React/RCTLog.h>
#import <React/RCTRedBoxSetEnabled.h>
#import <React/RCTSurface.h>
Expand All @@ -25,8 +25,6 @@ @implementation RCTLogBox {
__weak id<RCTSurfacePresenterStub> _bridgelessSurfacePresenter;
}

@synthesize bridge = _bridge;

RCT_EXPORT_MODULE()

+ (BOOL)requiresMainQueueSetup
Expand Down
1 change: 0 additions & 1 deletion packages/react-native/React/CoreModules/RCTLogBoxView.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

#import <React/RCTBridge.h>
#import <React/RCTSurfacePresenterStub.h>
#import <React/RCTSurfaceView.h>
#import <UIKit/UIKit.h>
Expand Down
1 change: 0 additions & 1 deletion packages/react-native/React/CoreModules/RCTRedBox.mm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ @implementation RCTRedBox {
NSMutableArray<RCTRedBoxButtonPressHandler> *_customButtonHandlers;
}

@synthesize bridge = _bridge;
@synthesize moduleRegistry = _moduleRegistry;
@synthesize bundleManager = _bundleManager;

Expand Down
1 change: 0 additions & 1 deletion packages/react-native/React/Views/RCTViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ - (void)updateAccessibilityTraitsForRole:(RCTView *)view withDefaultView:(RCTVie
RCT_CUSTOM_VIEW_PROPERTY(nativeID, NSString *, RCTView)
{
view.nativeID = json ? [RCTConvert NSString:json] : defaultView.nativeID;
[_bridge.uiManager setNativeID:view.nativeID forView:view];
}

RCT_CUSTOM_VIEW_PROPERTY(pointerEvents, RCTPointerEvents, RCTView)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ - (instancetype)initWithDelegate:(id<RCTInstanceDelegate>)delegate
_bridgeModuleDecorator = [[RCTBridgeModuleDecorator alloc] initWithViewRegistry:[RCTViewRegistry new]
moduleRegistry:moduleRegistry
bundleManager:bundleManager
callableJSModules:[RCTCallableJSModules new]];
callableJSModules:[RCTCallableJSModules new]
launchOptions:launchOptions
performanceLogger:_performanceLogger];
_devMenuConfigurationDecorator =
#if RCT_DEV_MENU
[[RCTDevMenuConfigurationDecorator alloc] initWithDevMenuConfiguration:devMenuConfiguration];
Expand Down
Loading
Loading