Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

What other parameter types can RCTPromiseResolveBlock take other than an array of strings?

$
0
0

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.


Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>