From f0ebfe380c8104c7ec0a944d298c50bf8ec026eb Mon Sep 17 00:00:00 2001 From: Lulu Wu Date: Fri, 21 Aug 2020 17:16:48 -0700 Subject: [PATCH] Convert RCTFileReaderModule to avoid using bridge Summary: Changelog: [iOS][Changed] - DescriptionConvert RCTFileReaderModule to avoid using bridge Reviewed By: PeteTheHeat Differential Revision: D23264211 fbshipit-source-id: 7d92749238aa45b4ff1b39c961e1b471f15df252 --- Libraries/Blob/RCTFileReaderModule.mm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Libraries/Blob/RCTFileReaderModule.mm b/Libraries/Blob/RCTFileReaderModule.mm index 62e817dc487..315605acc11 100644 --- a/Libraries/Blob/RCTFileReaderModule.mm +++ b/Libraries/Blob/RCTFileReaderModule.mm @@ -24,6 +24,7 @@ RCT_EXPORT_MODULE(FileReaderModule) @synthesize bridge = _bridge; +@synthesize turboModuleRegistry = _turboModuleRegistry; RCT_EXPORT_METHOD(readAsText:(NSDictionary *)blob encoding:(NSString *)encoding @@ -55,7 +56,12 @@ RCT_EXPORT_METHOD(readAsDataURL:(NSDictionary *)blob resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) { - RCTBlobManager *blobManager = [[self bridge] moduleForClass:[RCTBlobManager class]]; + RCTBlobManager *blobManager = nil; + if ([self bridge]) { + blobManager = [[self bridge] moduleForClass:[RCTBlobManager class]]; + } else { + blobManager = [[self turboModuleRegistry] moduleForName:[NSStringFromClass([RCTBlobManager class]) UTF8String]]; + } NSData *data = [blobManager resolve:blob]; if (data == nil) {