I have the following exported React Native method in my BridgeModule.m
file:
RCT_EXPORT_METHOD(resumePlaying: (NSInteger) location resolve: (RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)rejecter){ NSInteger resultCode = [self.LCSwift resumePlaying:location]; if (resultCode == 0) { NSString * message = [NSString stringWithFormat:@"Success in resuming playing."]; NSArray * messageArray = @[message]; resolve(messageArray); } else { rejecter(@"500", @"Failed to resume playing", nil); }}
In component.js
:
var response = await NativeModules.BridgeModule.resumePlaying(activePlayer);console.log(JSON.stringify(response)); //Produces ["Success in pausing playing."]localVideos[activePlayer].paused = false;
Since the result is typically captured by await or then-catch, I'm unsure of what can be passed into resolve other than an array of strings. Can I pass for example a single boolean? I can't find documentation on this class specifically.