From 37099efb285b6cd405b8bd58458896fb568e91c3 Mon Sep 17 00:00:00 2001 From: Edgar Aroutiounian Date: Sat, 12 Aug 2017 09:43:59 -0700 Subject: [PATCH] Generalize ActionSheetManager items --- .../ActionSheetIOS/RCTActionSheetManager.m | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Libraries/ActionSheetIOS/RCTActionSheetManager.m b/Libraries/ActionSheetIOS/RCTActionSheetManager.m index 9f550f77af32a4..708be80e0e07ad 100644 --- a/Libraries/ActionSheetIOS/RCTActionSheetManager.m +++ b/Libraries/ActionSheetIOS/RCTActionSheetManager.m @@ -133,11 +133,17 @@ - (CGRect)sourceRectInView:(UIView *)sourceView if (message) { [items addObject:message]; } - NSURL *URL = [RCTConvert NSURL:options[@"url"]]; - if (URL) { - if ([URL.scheme.lowercaseString isEqualToString:@"data"]) { + NSArray *URLS = [RCTConvert NSURLArray:options[@"url"]]; + + if (URLS.count == 0) { + RCTLogError(@"No `url` or `message` to share"); + return; + } + + for (NSURL *url in URLS) { + if ([url.scheme.lowercaseString isEqualToString:@"data"]) { NSError *error; - NSData *data = [NSData dataWithContentsOfURL:URL + NSData *data = [NSData dataWithContentsOfURL:url options:(NSDataReadingOptions)0 error:&error]; if (!data) { @@ -146,13 +152,9 @@ - (CGRect)sourceRectInView:(UIView *)sourceView } [items addObject:data]; } else { - [items addObject:URL]; + [items addObject:url]; } } - if (items.count == 0) { - RCTLogError(@"No `url` or `message` to share"); - return; - } UIActivityViewController *shareController = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];