mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
be53aae324
commit
f0ebfe380c
@@ -24,6 +24,7 @@
|
||||
RCT_EXPORT_MODULE(FileReaderModule)
|
||||
|
||||
@synthesize bridge = _bridge;
|
||||
@synthesize turboModuleRegistry = _turboModuleRegistry;
|
||||
|
||||
RCT_EXPORT_METHOD(readAsText:(NSDictionary<NSString *, id> *)blob
|
||||
encoding:(NSString *)encoding
|
||||
@@ -55,7 +56,12 @@ RCT_EXPORT_METHOD(readAsDataURL:(NSDictionary<NSString *, id> *)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) {
|
||||
|
||||
Reference in New Issue
Block a user