mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Drop RCTBridge reads from five new-arch-only modules (#59256)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/59256 RCTEventDispatcher routes via _dispatchToJSThread; RCTImageLoader and RCTNetworking require their registry-backed providers; RCTTestModule uses the injected viewRegistry_DEPRECATED; RCTViewManager drops a no-op registry write. Legacy RCTBridge is a stub, so these reads only reached RCTBridgeProxy shims. Changelog: [Internal] Reviewed By: javache Differential Revision: D126558187 fbshipit-source-id: 5a17e359289d606163149eae72e8bb077ed46a35
This commit is contained in:
1 parent
db5c52de8b
commit
c1d8139ae5
5 files changed
+12
-43
No files matched your search
@@ -85,7 +85,6 @@ static NSError *addResponseHeadersToError(NSError *originalError, NSHTTPURLRespo
|
||||
__weak id<RCTImageRedirectProtocol> _redirectDelegate;
|
||||
}
|
||||
|
||||
@synthesize bridge = _bridge;
|
||||
@synthesize moduleRegistry = _moduleRegistry;
|
||||
@synthesize maxConcurrentLoadingTasks = _maxConcurrentLoadingTasks;
|
||||
@synthesize maxConcurrentDecodingTasks = _maxConcurrentDecodingTasks;
|
||||
@@ -134,13 +133,8 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
_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;
|
||||
@@ -154,13 +148,8 @@ RCT_EXPORT_MODULE()
|
||||
}
|
||||
}];
|
||||
|
||||
// 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;
|
||||
|
||||
@@ -271,9 +271,8 @@ RCT_EXPORT_MODULE()
|
||||
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
|
||||
|
||||
@@ -40,7 +40,6 @@ static uint16_t RCTUniqueCoalescingKeyGenerator = 0;
|
||||
NSRecursiveLock *_observersLock;
|
||||
}
|
||||
|
||||
@synthesize bridge = _bridge;
|
||||
@synthesize dispatchToJSThread = _dispatchToJSThread;
|
||||
@synthesize callableJSModules = _callableJSModules;
|
||||
|
||||
@@ -175,13 +174,7 @@ RCT_EXPORT_MODULE()
|
||||
[_eventQueueLock unlock];
|
||||
|
||||
if (scheduleEventsDispatch) {
|
||||
if (_bridge != nullptr) {
|
||||
[_bridge
|
||||
dispatchBlock:^{
|
||||
[self flushEventsQueue];
|
||||
}
|
||||
queue:RCTJSThread];
|
||||
} else if (_dispatchToJSThread != nullptr) {
|
||||
if (_dispatchToJSThread != nullptr) {
|
||||
_dispatchToJSThread(^{
|
||||
[self flushEventsQueue];
|
||||
});
|
||||
|
||||
@@ -322,7 +322,6 @@ RCT_CUSTOM_VIEW_PROPERTY(accessibilityLargeContentTitle, NSString, RCTView)
|
||||
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)
|
||||
|
||||
@@ -90,26 +90,16 @@ NativeTestModuleSpecJSI::NativeTestModuleSpecJSI(const ObjCTurboModule::InitPara
|
||||
NSMutableDictionary<NSString *, NSNumber *> *_snapshotCounter;
|
||||
}
|
||||
|
||||
@synthesize bridge = _bridge;
|
||||
@synthesize moduleRegistry = _moduleRegistry;
|
||||
@synthesize viewRegistry_DEPRECATED = _viewRegistry_DEPRECATED;
|
||||
|
||||
RCT_EXPORT_MODULE()
|
||||
|
||||
- (dispatch_queue_t)methodQueue
|
||||
{
|
||||
return _bridge.uiManager.methodQueue;
|
||||
}
|
||||
|
||||
- (void)setMethodQueue:(dispatch_queue_t)methodQueue
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
- (void)verifySnapshot:(RCTResponseSenderBlock)callback
|
||||
{
|
||||
RCTAssert(_controller != nil, @"No snapshot controller configured.");
|
||||
|
||||
[_bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
||||
[_viewRegistry_DEPRECATED addUIBlock:^(__unused RCTViewRegistry *viewRegistry) {
|
||||
NSString *testName = NSStringFromSelector(self->_testSelector);
|
||||
if (!self->_snapshotCounter) {
|
||||
self->_snapshotCounter = [NSMutableDictionary new];
|
||||
@@ -163,10 +153,9 @@ RCT_REMAP_METHOD(
|
||||
|
||||
- (void)markTestPassed:(BOOL)success
|
||||
{
|
||||
[_bridge.uiManager
|
||||
addUIBlock:^(__unused RCTUIManager *uiManager, __unused NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
||||
self->_status = success ? RCTTestStatusPassed : RCTTestStatusFailed;
|
||||
}];
|
||||
[_viewRegistry_DEPRECATED addUIBlock:^(__unused RCTViewRegistry *viewRegistry) {
|
||||
self->_status = success ? RCTTestStatusPassed : RCTTestStatusFailed;
|
||||
}];
|
||||
}
|
||||
|
||||
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
||||
|
||||
Reference in new issue
Block a user