Skip to content

Commit

Permalink
Update broken example when loading images
Browse files Browse the repository at this point in the history
  • Loading branch information
ryancoughlin committed Mar 22, 2017
1 parent 919c745 commit 9e6d008
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions ActivityView.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,18 @@ - (NSArray*)excludedActivitiesForKeys:(NSArray*)passedKeys {
return [self showWithOptions:args image:shareImage];
}

RCTImageLoader *loader = (RCTImageLoader*)[self.bridge moduleForClass:[RCTImageLoader class]];

__weak ActivityView *weakSelf = self;

[loader loadImageWithURLRequest:imageUrl callback:^(NSError *error, id imageOrData) {
[self.bridge.imageLoader loadImageWithURLRequest: [RCTConvert NSURLRequest: imageUrl]
callback:^(NSError *error, UIImage *image) {
if (!error) {
if ([imageOrData isKindOfClass:[NSData class]]) {
shareImage = [UIImage imageWithData:imageOrData];
} else {
shareImage = imageOrData;
}
dispatch_async([weakSelf methodQueue], ^{
[weakSelf showWithOptions:args image:image];
});
} else {
RCTLogWarn(@"[ActivityView] Could not fetch image.");
}

dispatch_async([weakSelf methodQueue], ^{
[weakSelf showWithOptions:args image:shareImage];
});
}];
}

Expand Down

0 comments on commit 9e6d008

Please sign in to comment.