Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. //
  2. // JTSImagePreview.m
  3. // RNImagePreview
  4. //
  5. // Created by Gant Laborde on 2/1/16.
  6. //
  7. #import "JTSImagePreview.h"
  8. #import "RCTLog.h"
  9. #import <JTSImageViewController.h>
  10. #import "AppDelegate.h"
  11. @implementation JTSImagePreview
  12.  
  13. RCT_EXPORT_MODULE();
  14.  
  15. RCT_EXPORT_METHOD(showImage:(NSString *)url)
  16. {
  17. // Here's our method's code
  18. RCTLogInfo(@"showImage with url %@", url);
  19. // Create image info
  20. JTSImageInfo *imageInfo = [[JTSImageInfo alloc] init];
  21. imageInfo.imageURL = [NSURL URLWithString:url];
  22.  
  23. JTSImageViewController *imageViewer = [[JTSImageViewController alloc]
  24. initWithImageInfo:imageInfo
  25. mode:JTSImageViewControllerMode_Image
  26. backgroundStyle:JTSImageViewControllerBackgroundOption_None];
  27.  
  28. // Get root to show from
  29. AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  30.  
  31. dispatch_async(dispatch_get_main_queue(), ^{
  32. [imageViewer showFromViewController:delegate.rootViewController transition:JTSImageViewControllerTransition_FromOffscreen];
  33. });
  34. }
  35.  
  36. @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement