├── .gitignore ├── README.md ├── ReactNativeImageCropping.h ├── ReactNativeImageCropping.m ├── ReactNativeImageCropping.xcodeproj ├── project.pbxproj └── xcuserdata │ └── meznaric.xcuserdatad │ └── xcschemes │ ├── ReactNativeImageCropping.xcscheme │ └── xcschememanagement.plist └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/* 2 | node_modules 3 | npm-debug.log 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Simple react-native image cropping library wrapper around [siong1987/TOCropViewController](https://github.com/siong1987/TOCropViewController) 2 | 3 | ![TOCropViewController](https://raw.githubusercontent.com/siong1987/TOCropViewController/master/screenshot.jpg) 4 | 5 | ## Installation 6 | 7 | Supported only on iOS. 8 | 9 | ### Add it to your project 10 | 11 | 1. `npm install react-native-image-cropping --save` 12 | 2. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]` 13 | 3. Go to `node_modules` ➜ `react-native-image-cropping` and add `ReactNativeImageCropping.xcodeproj` 14 | 4. In XCode, in the project navigator, select your project. Add `libReactNativeImageCropping.a` to your project's `Build Phases` ➜ `Link Binary With Libraries` 15 | 5. Click `ReactNativeImageCropping.xcodeproj` in the project navigator and go the `Build Settings` tab. Make sure 'All' is toggled on (instead of 'Basic'). Look for `Header Search Paths` and make sure it contains both `$(SRCROOT)/../react-native/React` and `$(SRCROOT)/../../React` - mark both as `recursive`. 16 | 5. Re-run your project (`Cmd+R`) 17 | 18 | ### Setup trouble? 19 | 20 | If you get stuck open an issue. It's the first time I've published react native package and I may have not provided all necessary information. 21 | 22 | ## Usage 23 | 24 | ### Import module 25 | 26 | ```javascript 27 | const React = require('react-native'); 28 | const {ReactNativeImageCropping} = React.NativeModules; 29 | ``` 30 | 31 | ### Crop the image 32 | 33 | It is using RCTImageLoader so it should be able to crop any image that react knows how to load / display. 34 | 35 | #### Without aspect ratio restriction: 36 | 37 | ```javascript 38 | const originalImage = require('CrazyFlowers.jpg'); 39 | 40 | ReactNativeImageCropping 41 | .cropImageWithUrl(originalImage.uri) 42 | .then(image => { 43 | //Image is saved in NSTemporaryDirectory! 44 | //image = {uri, width, height} 45 | }, 46 | err => console.log(b)); 47 | ``` 48 | 49 | #### Lock to specific aspect ratio: 50 | 51 | Available aspect ratios: 52 | ```javascript 53 | - AspectRatioOriginal 54 | - AspectRatioSquare 55 | - AspectRatio3x2 56 | - AspectRatio5x4 57 | - AspectRatio4x3 58 | - AspectRatio5x4 59 | - AspectRatio7x5 60 | - AspectRatio16x9 61 | ``` 62 | 63 | Example: 64 | 65 | ```javascript 66 | let aspectRatio = ReactNativeImageCropping.AspectRatioSquare; 67 | 68 | ReactNativeImageCropping 69 | .cropImageWithUrlAndAspect(imageUrl, aspectRatio) 70 | .then(image => { 71 | //Image is saved in NSTemporaryDirectory! 72 | //image = {uri, width, height} 73 | }, 74 | err => console.log(b)); 75 | ``` 76 | 77 | 78 | -------------------------------------------------------------------------------- /ReactNativeImageCropping.h: -------------------------------------------------------------------------------- 1 | #import "RCTBridgeModule.h" 2 | #import "TOCropView.h" 3 | #import 4 | 5 | @interface ReactNativeImageCropping : NSObject 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /ReactNativeImageCropping.m: -------------------------------------------------------------------------------- 1 | #import "ReactNativeImageCropping.h" 2 | #import 3 | #import "TOCropViewController.h" 4 | 5 | @interface ReactNativeImageCropping () 6 | 7 | @property (nonatomic, strong) RCTPromiseRejectBlock _reject; 8 | @property (nonatomic, strong) RCTPromiseResolveBlock _resolve; 9 | @property TOCropViewControllerAspectRatio aspectRatio; 10 | 11 | 12 | @end 13 | 14 | @implementation RCTConvert (AspectRatio) 15 | RCT_ENUM_CONVERTER(TOCropViewControllerAspectRatio, (@{ 16 | @"AspectRatioOriginal" : @(TOCropViewControllerAspectRatioOriginal), 17 | @"AspectRatioSquare" : @(TOCropViewControllerAspectRatioSquare), 18 | @"AspectRatio3x2" : @(TOCropViewControllerAspectRatio3x2), 19 | @"AspectRatio5x3" : @(TOCropViewControllerAspectRatio5x3), 20 | @"AspectRatio4x3" : @(TOCropViewControllerAspectRatio4x3), 21 | @"AspectRatio5x4" : @(TOCropViewControllerAspectRatio5x4), 22 | @"AspectRatio7x5" : @(TOCropViewControllerAspectRatio7x5), 23 | @"AspectRatio16x9" : @(TOCropViewControllerAspectRatio16x9) 24 | }), UIStatusBarAnimationNone, integerValue) 25 | @end 26 | 27 | @implementation ReactNativeImageCropping 28 | 29 | RCT_EXPORT_MODULE() 30 | 31 | 32 | @synthesize bridge = _bridge; 33 | 34 | - (NSDictionary *)constantsToExport 35 | { 36 | return @{ 37 | @"AspectRatioOriginal" : @(TOCropViewControllerAspectRatioOriginal), 38 | @"AspectRatioSquare" : @(TOCropViewControllerAspectRatioSquare), 39 | @"AspectRatio3x2" : @(TOCropViewControllerAspectRatio3x2), 40 | @"AspectRatio5x3" : @(TOCropViewControllerAspectRatio5x3), 41 | @"AspectRatio4x3" : @(TOCropViewControllerAspectRatio4x3), 42 | @"AspectRatio5x4" : @(TOCropViewControllerAspectRatio5x4), 43 | @"AspectRatio7x5" : @(TOCropViewControllerAspectRatio7x5), 44 | @"AspectRatio16x9" : @(TOCropViewControllerAspectRatio16x9), 45 | }; 46 | } 47 | 48 | RCT_EXPORT_METHOD( cropImageWithUrl:(NSString *)imageUrl 49 | resolver:(RCTPromiseResolveBlock)resolve 50 | rejecter:(RCTPromiseRejectBlock)reject 51 | 52 | ) 53 | { 54 | self._reject = reject; 55 | self._resolve = resolve; 56 | self.aspectRatio = NULL; 57 | 58 | NSURLRequest *imageUrlrequest = [NSURLRequest requestWithURL:[NSURL URLWithString:imageUrl]]; 59 | 60 | [self.bridge.imageLoader loadImageWithURLRequest:imageUrlrequest callback:^(NSError *error, UIImage *image) { 61 | if(error) reject(@"100", @"Failed to load image", error); 62 | if(image) { 63 | [self handleImageLoad:image]; 64 | } 65 | }]; 66 | } 67 | 68 | RCT_EXPORT_METHOD(cropImageWithUrlAndAspect:(NSString *)imageUrl 69 | aspectRatio:(TOCropViewControllerAspectRatio)aspectRatio 70 | resolver:(RCTPromiseResolveBlock)resolve 71 | rejecter:(RCTPromiseRejectBlock)reject 72 | ) 73 | { 74 | self._reject = reject; 75 | self._resolve = resolve; 76 | self.aspectRatio = aspectRatio; 77 | 78 | NSURLRequest *imageUrlrequest = [NSURLRequest requestWithURL:[NSURL URLWithString:imageUrl]]; 79 | 80 | [self.bridge.imageLoader loadImageWithURLRequest:imageUrlrequest callback:^(NSError *error, UIImage *image) { 81 | if(error) reject(@"100", @"Failed to load image", error); 82 | if(image) { 83 | [self handleImageLoad:image]; 84 | } 85 | }]; 86 | 87 | } 88 | 89 | - (void)handleImageLoad:(UIImage *)image { 90 | 91 | UIViewController *root = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; 92 | TOCropViewController *cropViewController = [[TOCropViewController alloc] initWithImage:image]; 93 | cropViewController.delegate = self; 94 | 95 | if(self.aspectRatio) { 96 | cropViewController.lockedAspectRatio = YES; 97 | cropViewController.defaultAspectRatio = self.aspectRatio; 98 | } 99 | dispatch_async(dispatch_get_main_queue(), ^{ 100 | [root presentViewController:cropViewController animated:YES completion:nil]; 101 | }); 102 | } 103 | 104 | /** 105 | Called when the user has committed the crop action, and provides both the original image with crop co-ordinates. 106 | 107 | @param image The newly cropped image. 108 | @param cropRect A rectangle indicating the crop region of the image the user chose (In the original image's local co-ordinate space) 109 | */ 110 | - (void)cropViewController:(TOCropViewController *)cropViewController didCropToImage:(UIImage *)image withRect:(CGRect)cropRect angle:(NSInteger)angle 111 | { 112 | dispatch_async(dispatch_get_main_queue(), ^{ 113 | [cropViewController dismissViewControllerAnimated:YES completion:nil]; 114 | }); 115 | 116 | NSData *pngData = UIImagePNGRepresentation(image); 117 | NSString *fileName = [NSString stringWithFormat:@"memegenerator-crop-%lf.png", [NSDate timeIntervalSinceReferenceDate]]; 118 | NSString *filePath = [NSTemporaryDirectory() stringByAppendingPathComponent:fileName]; //Add the file name) 119 | [pngData writeToFile:filePath atomically:YES]; 120 | NSNumber *width = [NSNumber numberWithFloat:image.size.width]; 121 | NSNumber *height = [NSNumber numberWithFloat:image.size.height]; 122 | 123 | NSDictionary * imageData = @{ 124 | @"uri":filePath, 125 | @"width":width, 126 | @"height":height 127 | }; 128 | self._resolve(imageData); 129 | } 130 | /** 131 | If implemented, when the user hits cancel, or completes a UIActivityViewController operation, this delegate will be called, 132 | giving you a chance to manually dismiss the view controller 133 | 134 | */ 135 | - (void)cropViewController:(TOCropViewController *)cropViewController didFinishCancelled:(BOOL)cancelled 136 | { 137 | dispatch_async(dispatch_get_main_queue(), ^{ 138 | [cropViewController dismissViewControllerAnimated:YES completion:nil]; 139 | }); 140 | self._reject(@"400", @"Cancelled", [NSError errorWithDomain:@"Cancelled" code:400 userInfo:NULL]); 141 | } 142 | @end 143 | -------------------------------------------------------------------------------- /ReactNativeImageCropping.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 13BE3DEE1AC21097009241FE /* ReactNativeImageCropping.m in Sources */ = {isa = PBXBuildFile; fileRef = 13BE3DED1AC21097009241FE /* ReactNativeImageCropping.m */; }; 11 | 5EA0546E1C924473003BAF9C /* TOActivityCroppedImageProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EA054561C924473003BAF9C /* TOActivityCroppedImageProvider.m */; }; 12 | 5EA0546F1C924473003BAF9C /* TOCroppedImageAttributes.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EA054581C924473003BAF9C /* TOCroppedImageAttributes.m */; }; 13 | 5EA054701C924473003BAF9C /* TOCropViewControllerTransitioning.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EA0545A1C924473003BAF9C /* TOCropViewControllerTransitioning.m */; }; 14 | 5EA054711C924473003BAF9C /* UIImage+CropRotate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EA0545C1C924473003BAF9C /* UIImage+CropRotate.m */; }; 15 | 5EA054721C924473003BAF9C /* TOCropViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EA054621C924473003BAF9C /* TOCropViewController.m */; }; 16 | 5EA054731C924473003BAF9C /* TOCropOverlayView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EA054651C924473003BAF9C /* TOCropOverlayView.m */; }; 17 | 5EA054741C924473003BAF9C /* TOCropScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EA054671C924473003BAF9C /* TOCropScrollView.m */; }; 18 | 5EA054751C924473003BAF9C /* TOCropToolbar.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EA054691C924473003BAF9C /* TOCropToolbar.m */; }; 19 | 5EA054761C924473003BAF9C /* TOCropView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5EA0546B1C924473003BAF9C /* TOCropView.m */; }; 20 | /* End PBXBuildFile section */ 21 | 22 | /* Begin PBXCopyFilesBuildPhase section */ 23 | 58B511D91A9E6C8500147676 /* CopyFiles */ = { 24 | isa = PBXCopyFilesBuildPhase; 25 | buildActionMask = 2147483647; 26 | dstPath = "include/$(PRODUCT_NAME)"; 27 | dstSubfolderSpec = 16; 28 | files = ( 29 | ); 30 | runOnlyForDeploymentPostprocessing = 0; 31 | }; 32 | /* End PBXCopyFilesBuildPhase section */ 33 | 34 | /* Begin PBXFileReference section */ 35 | 134814201AA4EA6300B7C361 /* libReactNativeImageCropping.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libReactNativeImageCropping.a; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | 13BE3DEC1AC21097009241FE /* ReactNativeImageCropping.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReactNativeImageCropping.h; sourceTree = ""; }; 37 | 13BE3DED1AC21097009241FE /* ReactNativeImageCropping.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReactNativeImageCropping.m; sourceTree = ""; }; 38 | 5EA0544B1C924473003BAF9C /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/TOCropViewControllerLocalizable.strings; sourceTree = ""; }; 39 | 5EA0544C1C924473003BAF9C /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/TOCropViewControllerLocalizable.strings; sourceTree = ""; }; 40 | 5EA0544D1C924473003BAF9C /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/TOCropViewControllerLocalizable.strings; sourceTree = ""; }; 41 | 5EA0544E1C924473003BAF9C /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/TOCropViewControllerLocalizable.strings; sourceTree = ""; }; 42 | 5EA0544F1C924473003BAF9C /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/TOCropViewControllerLocalizable.strings; sourceTree = ""; }; 43 | 5EA054501C924473003BAF9C /* id */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = id; path = id.lproj/TOCropViewControllerLocalizable.strings; sourceTree = ""; }; 44 | 5EA054511C924473003BAF9C /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/TOCropViewControllerLocalizable.strings; sourceTree = ""; }; 45 | 5EA054521C924473003BAF9C /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/TOCropViewControllerLocalizable.strings; sourceTree = ""; }; 46 | 5EA054531C924473003BAF9C /* ko */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ko; path = ko.lproj/TOCropViewControllerLocalizable.strings; sourceTree = ""; }; 47 | 5EA054551C924473003BAF9C /* TOActivityCroppedImageProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TOActivityCroppedImageProvider.h; sourceTree = ""; }; 48 | 5EA054561C924473003BAF9C /* TOActivityCroppedImageProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TOActivityCroppedImageProvider.m; sourceTree = ""; }; 49 | 5EA054571C924473003BAF9C /* TOCroppedImageAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TOCroppedImageAttributes.h; sourceTree = ""; }; 50 | 5EA054581C924473003BAF9C /* TOCroppedImageAttributes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TOCroppedImageAttributes.m; sourceTree = ""; }; 51 | 5EA054591C924473003BAF9C /* TOCropViewControllerTransitioning.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TOCropViewControllerTransitioning.h; sourceTree = ""; }; 52 | 5EA0545A1C924473003BAF9C /* TOCropViewControllerTransitioning.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TOCropViewControllerTransitioning.m; sourceTree = ""; }; 53 | 5EA0545B1C924473003BAF9C /* UIImage+CropRotate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+CropRotate.h"; sourceTree = ""; }; 54 | 5EA0545C1C924473003BAF9C /* UIImage+CropRotate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+CropRotate.m"; sourceTree = ""; }; 55 | 5EA0545D1C924473003BAF9C /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/TOCropViewControllerLocalizable.strings; sourceTree = ""; }; 56 | 5EA0545E1C924473003BAF9C /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/TOCropViewControllerLocalizable.strings; sourceTree = ""; }; 57 | 5EA0545F1C924473003BAF9C /* pt */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pt; path = pt.lproj/TOCropViewControllerLocalizable.strings; sourceTree = ""; }; 58 | 5EA054601C924473003BAF9C /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/TOCropViewControllerLocalizable.strings; sourceTree = ""; }; 59 | 5EA054611C924473003BAF9C /* TOCropViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TOCropViewController.h; sourceTree = ""; }; 60 | 5EA054621C924473003BAF9C /* TOCropViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TOCropViewController.m; sourceTree = ""; }; 61 | 5EA054641C924473003BAF9C /* TOCropOverlayView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TOCropOverlayView.h; sourceTree = ""; }; 62 | 5EA054651C924473003BAF9C /* TOCropOverlayView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TOCropOverlayView.m; sourceTree = ""; }; 63 | 5EA054661C924473003BAF9C /* TOCropScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TOCropScrollView.h; sourceTree = ""; }; 64 | 5EA054671C924473003BAF9C /* TOCropScrollView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TOCropScrollView.m; sourceTree = ""; }; 65 | 5EA054681C924473003BAF9C /* TOCropToolbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TOCropToolbar.h; sourceTree = ""; }; 66 | 5EA054691C924473003BAF9C /* TOCropToolbar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TOCropToolbar.m; sourceTree = ""; }; 67 | 5EA0546A1C924473003BAF9C /* TOCropView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TOCropView.h; sourceTree = ""; }; 68 | 5EA0546B1C924473003BAF9C /* TOCropView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TOCropView.m; sourceTree = ""; }; 69 | 5EA0546C1C924473003BAF9C /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/TOCropViewControllerLocalizable.strings"; sourceTree = ""; }; 70 | 5EA0546D1C924473003BAF9C /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/TOCropViewControllerLocalizable.strings"; sourceTree = ""; }; 71 | /* End PBXFileReference section */ 72 | 73 | /* Begin PBXFrameworksBuildPhase section */ 74 | 58B511D81A9E6C8500147676 /* Frameworks */ = { 75 | isa = PBXFrameworksBuildPhase; 76 | buildActionMask = 2147483647; 77 | files = ( 78 | ); 79 | runOnlyForDeploymentPostprocessing = 0; 80 | }; 81 | /* End PBXFrameworksBuildPhase section */ 82 | 83 | /* Begin PBXGroup section */ 84 | 134814211AA4EA7D00B7C361 /* Products */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 134814201AA4EA6300B7C361 /* libReactNativeImageCropping.a */, 88 | ); 89 | name = Products; 90 | sourceTree = ""; 91 | }; 92 | 58B511D21A9E6C8500147676 = { 93 | isa = PBXGroup; 94 | children = ( 95 | 5EA054491C924473003BAF9C /* TOCropViewController */, 96 | 13BE3DEC1AC21097009241FE /* ReactNativeImageCropping.h */, 97 | 13BE3DED1AC21097009241FE /* ReactNativeImageCropping.m */, 98 | 134814211AA4EA7D00B7C361 /* Products */, 99 | ); 100 | sourceTree = ""; 101 | }; 102 | 5EA054491C924473003BAF9C /* TOCropViewController */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 5EA0544A1C924473003BAF9C /* TOCropViewControllerLocalizable.strings */, 106 | 5EA054541C924473003BAF9C /* Models */, 107 | 5EA054611C924473003BAF9C /* TOCropViewController.h */, 108 | 5EA054621C924473003BAF9C /* TOCropViewController.m */, 109 | 5EA054631C924473003BAF9C /* Views */, 110 | ); 111 | name = TOCropViewController; 112 | path = ../TOCropViewController/TOCropViewController; 113 | sourceTree = ""; 114 | }; 115 | 5EA054541C924473003BAF9C /* Models */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | 5EA054551C924473003BAF9C /* TOActivityCroppedImageProvider.h */, 119 | 5EA054561C924473003BAF9C /* TOActivityCroppedImageProvider.m */, 120 | 5EA054571C924473003BAF9C /* TOCroppedImageAttributes.h */, 121 | 5EA054581C924473003BAF9C /* TOCroppedImageAttributes.m */, 122 | 5EA054591C924473003BAF9C /* TOCropViewControllerTransitioning.h */, 123 | 5EA0545A1C924473003BAF9C /* TOCropViewControllerTransitioning.m */, 124 | 5EA0545B1C924473003BAF9C /* UIImage+CropRotate.h */, 125 | 5EA0545C1C924473003BAF9C /* UIImage+CropRotate.m */, 126 | ); 127 | path = Models; 128 | sourceTree = ""; 129 | }; 130 | 5EA054631C924473003BAF9C /* Views */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 5EA054641C924473003BAF9C /* TOCropOverlayView.h */, 134 | 5EA054651C924473003BAF9C /* TOCropOverlayView.m */, 135 | 5EA054661C924473003BAF9C /* TOCropScrollView.h */, 136 | 5EA054671C924473003BAF9C /* TOCropScrollView.m */, 137 | 5EA054681C924473003BAF9C /* TOCropToolbar.h */, 138 | 5EA054691C924473003BAF9C /* TOCropToolbar.m */, 139 | 5EA0546A1C924473003BAF9C /* TOCropView.h */, 140 | 5EA0546B1C924473003BAF9C /* TOCropView.m */, 141 | ); 142 | path = Views; 143 | sourceTree = ""; 144 | }; 145 | /* End PBXGroup section */ 146 | 147 | /* Begin PBXNativeTarget section */ 148 | 58B511DA1A9E6C8500147676 /* ReactNativeImageCropping */ = { 149 | isa = PBXNativeTarget; 150 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "ReactNativeImageCropping" */; 151 | buildPhases = ( 152 | 58B511D71A9E6C8500147676 /* Sources */, 153 | 58B511D81A9E6C8500147676 /* Frameworks */, 154 | 58B511D91A9E6C8500147676 /* CopyFiles */, 155 | ); 156 | buildRules = ( 157 | ); 158 | dependencies = ( 159 | ); 160 | name = ReactNativeImageCropping; 161 | productName = RCTDataManager; 162 | productReference = 134814201AA4EA6300B7C361 /* libReactNativeImageCropping.a */; 163 | productType = "com.apple.product-type.library.static"; 164 | }; 165 | /* End PBXNativeTarget section */ 166 | 167 | /* Begin PBXProject section */ 168 | 58B511D31A9E6C8500147676 /* Project object */ = { 169 | isa = PBXProject; 170 | attributes = { 171 | LastUpgradeCheck = 0610; 172 | ORGANIZATIONNAME = Facebook; 173 | TargetAttributes = { 174 | 58B511DA1A9E6C8500147676 = { 175 | CreatedOnToolsVersion = 6.1.1; 176 | }; 177 | }; 178 | }; 179 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "ReactNativeImageCropping" */; 180 | compatibilityVersion = "Xcode 3.2"; 181 | developmentRegion = English; 182 | hasScannedForEncodings = 0; 183 | knownRegions = ( 184 | en, 185 | Base, 186 | de, 187 | es, 188 | fr, 189 | id, 190 | it, 191 | ja, 192 | ko, 193 | nl, 194 | pl, 195 | pt, 196 | ru, 197 | "zh-Hans", 198 | "zh-Hant", 199 | ); 200 | mainGroup = 58B511D21A9E6C8500147676; 201 | productRefGroup = 58B511D21A9E6C8500147676; 202 | projectDirPath = ""; 203 | projectRoot = ""; 204 | targets = ( 205 | 58B511DA1A9E6C8500147676 /* ReactNativeImageCropping */, 206 | ); 207 | }; 208 | /* End PBXProject section */ 209 | 210 | /* Begin PBXSourcesBuildPhase section */ 211 | 58B511D71A9E6C8500147676 /* Sources */ = { 212 | isa = PBXSourcesBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | 5EA054711C924473003BAF9C /* UIImage+CropRotate.m in Sources */, 216 | 5EA054761C924473003BAF9C /* TOCropView.m in Sources */, 217 | 5EA0546F1C924473003BAF9C /* TOCroppedImageAttributes.m in Sources */, 218 | 5EA054751C924473003BAF9C /* TOCropToolbar.m in Sources */, 219 | 5EA054701C924473003BAF9C /* TOCropViewControllerTransitioning.m in Sources */, 220 | 5EA0546E1C924473003BAF9C /* TOActivityCroppedImageProvider.m in Sources */, 221 | 5EA054731C924473003BAF9C /* TOCropOverlayView.m in Sources */, 222 | 13BE3DEE1AC21097009241FE /* ReactNativeImageCropping.m in Sources */, 223 | 5EA054741C924473003BAF9C /* TOCropScrollView.m in Sources */, 224 | 5EA054721C924473003BAF9C /* TOCropViewController.m in Sources */, 225 | ); 226 | runOnlyForDeploymentPostprocessing = 0; 227 | }; 228 | /* End PBXSourcesBuildPhase section */ 229 | 230 | /* Begin PBXVariantGroup section */ 231 | 5EA0544A1C924473003BAF9C /* TOCropViewControllerLocalizable.strings */ = { 232 | isa = PBXVariantGroup; 233 | children = ( 234 | 5EA0544B1C924473003BAF9C /* Base */, 235 | 5EA0544C1C924473003BAF9C /* de */, 236 | 5EA0544D1C924473003BAF9C /* en */, 237 | 5EA0544E1C924473003BAF9C /* es */, 238 | 5EA0544F1C924473003BAF9C /* fr */, 239 | 5EA054501C924473003BAF9C /* id */, 240 | 5EA054511C924473003BAF9C /* it */, 241 | 5EA054521C924473003BAF9C /* ja */, 242 | 5EA054531C924473003BAF9C /* ko */, 243 | 5EA0545D1C924473003BAF9C /* nl */, 244 | 5EA0545E1C924473003BAF9C /* pl */, 245 | 5EA0545F1C924473003BAF9C /* pt */, 246 | 5EA054601C924473003BAF9C /* ru */, 247 | 5EA0546C1C924473003BAF9C /* zh-Hans */, 248 | 5EA0546D1C924473003BAF9C /* zh-Hant */, 249 | ); 250 | name = TOCropViewControllerLocalizable.strings; 251 | sourceTree = ""; 252 | }; 253 | /* End PBXVariantGroup section */ 254 | 255 | /* Begin XCBuildConfiguration section */ 256 | 58B511ED1A9E6C8500147676 /* Debug */ = { 257 | isa = XCBuildConfiguration; 258 | buildSettings = { 259 | ALWAYS_SEARCH_USER_PATHS = NO; 260 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 261 | CLANG_CXX_LIBRARY = "libc++"; 262 | CLANG_ENABLE_MODULES = YES; 263 | CLANG_ENABLE_OBJC_ARC = YES; 264 | CLANG_WARN_BOOL_CONVERSION = YES; 265 | CLANG_WARN_CONSTANT_CONVERSION = YES; 266 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 267 | CLANG_WARN_EMPTY_BODY = YES; 268 | CLANG_WARN_ENUM_CONVERSION = YES; 269 | CLANG_WARN_INT_CONVERSION = YES; 270 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 271 | CLANG_WARN_UNREACHABLE_CODE = YES; 272 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 273 | COPY_PHASE_STRIP = NO; 274 | ENABLE_STRICT_OBJC_MSGSEND = YES; 275 | GCC_C_LANGUAGE_STANDARD = gnu99; 276 | GCC_DYNAMIC_NO_PIC = NO; 277 | GCC_OPTIMIZATION_LEVEL = 0; 278 | GCC_PREPROCESSOR_DEFINITIONS = ( 279 | "DEBUG=1", 280 | "$(inherited)", 281 | ); 282 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 283 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 284 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 285 | GCC_WARN_UNDECLARED_SELECTOR = YES; 286 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 287 | GCC_WARN_UNUSED_FUNCTION = YES; 288 | GCC_WARN_UNUSED_VARIABLE = YES; 289 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 290 | MTL_ENABLE_DEBUG_INFO = YES; 291 | ONLY_ACTIVE_ARCH = YES; 292 | SDKROOT = iphoneos; 293 | }; 294 | name = Debug; 295 | }; 296 | 58B511EE1A9E6C8500147676 /* Release */ = { 297 | isa = XCBuildConfiguration; 298 | buildSettings = { 299 | ALWAYS_SEARCH_USER_PATHS = NO; 300 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 301 | CLANG_CXX_LIBRARY = "libc++"; 302 | CLANG_ENABLE_MODULES = YES; 303 | CLANG_ENABLE_OBJC_ARC = YES; 304 | CLANG_WARN_BOOL_CONVERSION = YES; 305 | CLANG_WARN_CONSTANT_CONVERSION = YES; 306 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 307 | CLANG_WARN_EMPTY_BODY = YES; 308 | CLANG_WARN_ENUM_CONVERSION = YES; 309 | CLANG_WARN_INT_CONVERSION = YES; 310 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 311 | CLANG_WARN_UNREACHABLE_CODE = YES; 312 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 313 | COPY_PHASE_STRIP = YES; 314 | ENABLE_NS_ASSERTIONS = NO; 315 | ENABLE_STRICT_OBJC_MSGSEND = YES; 316 | GCC_C_LANGUAGE_STANDARD = gnu99; 317 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 318 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 319 | GCC_WARN_UNDECLARED_SELECTOR = YES; 320 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 321 | GCC_WARN_UNUSED_FUNCTION = YES; 322 | GCC_WARN_UNUSED_VARIABLE = YES; 323 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 324 | MTL_ENABLE_DEBUG_INFO = NO; 325 | SDKROOT = iphoneos; 326 | VALIDATE_PRODUCT = YES; 327 | }; 328 | name = Release; 329 | }; 330 | 58B511F01A9E6C8500147676 /* Debug */ = { 331 | isa = XCBuildConfiguration; 332 | buildSettings = { 333 | HEADER_SEARCH_PATHS = ( 334 | "$(inherited)", 335 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 336 | "$(SRCROOT)/../../React/**", 337 | "$(SRCROOT)/../../node_modules/react-native/React/**", 338 | "$(SRCROOT)/../react-native/Libraries/Network/**", 339 | "$(SRCROOT)/../react-native/Libraries/Image/**", 340 | ); 341 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 342 | OTHER_LDFLAGS = "-ObjC"; 343 | PRODUCT_NAME = ReactNativeImageCropping; 344 | SKIP_INSTALL = YES; 345 | }; 346 | name = Debug; 347 | }; 348 | 58B511F11A9E6C8500147676 /* Release */ = { 349 | isa = XCBuildConfiguration; 350 | buildSettings = { 351 | HEADER_SEARCH_PATHS = ( 352 | "$(inherited)", 353 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 354 | "$(SRCROOT)/../../React/**", 355 | "$(SRCROOT)/../../node_modules/react-native/React/**", 356 | "$(SRCROOT)/../react-native/Libraries/Network/**", 357 | "$(SRCROOT)/../react-native/Libraries/Image/**", 358 | ); 359 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 360 | OTHER_LDFLAGS = "-ObjC"; 361 | PRODUCT_NAME = ReactNativeImageCropping; 362 | SKIP_INSTALL = YES; 363 | }; 364 | name = Release; 365 | }; 366 | /* End XCBuildConfiguration section */ 367 | 368 | /* Begin XCConfigurationList section */ 369 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "ReactNativeImageCropping" */ = { 370 | isa = XCConfigurationList; 371 | buildConfigurations = ( 372 | 58B511ED1A9E6C8500147676 /* Debug */, 373 | 58B511EE1A9E6C8500147676 /* Release */, 374 | ); 375 | defaultConfigurationIsVisible = 0; 376 | defaultConfigurationName = Release; 377 | }; 378 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "ReactNativeImageCropping" */ = { 379 | isa = XCConfigurationList; 380 | buildConfigurations = ( 381 | 58B511F01A9E6C8500147676 /* Debug */, 382 | 58B511F11A9E6C8500147676 /* Release */, 383 | ); 384 | defaultConfigurationIsVisible = 0; 385 | defaultConfigurationName = Release; 386 | }; 387 | /* End XCConfigurationList section */ 388 | }; 389 | rootObject = 58B511D31A9E6C8500147676 /* Project object */; 390 | } 391 | -------------------------------------------------------------------------------- /ReactNativeImageCropping.xcodeproj/xcuserdata/meznaric.xcuserdatad/xcschemes/ReactNativeImageCropping.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /ReactNativeImageCropping.xcodeproj/xcuserdata/meznaric.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ReactNativeImageCropping.xcscheme 8 | 9 | orderHint 10 | 13 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 58B511DA1A9E6C8500147676 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-image-cropping", 3 | "version": "1.0.0", 4 | "keywords": "react-native image cropping", 5 | "description": "Simple image cropping library for react-native.", 6 | "license": "MIT", 7 | "repository": "meznaric/react-native-image-cropping", 8 | "dependencies": { 9 | "TOCropViewController": "git+https://github.com/meznaric/TOCropViewController.git" 10 | }, 11 | "peerDependencies": { 12 | "react-native": "^0.28.0" 13 | } 14 | } 15 | --------------------------------------------------------------------------------