diff --git a/README.md b/README.md
index c3e4ae8..154d101 100755
--- a/README.md
+++ b/README.md
@@ -52,7 +52,7 @@ ImageEditor.cropImage(uri, cropData).then((url) => {
| `offset` | Yes | The top-left corner of the cropped image, specified in the original image's coordinate space |
| `size` | Yes | Size (dimensions) of the cropped image |
| `displaySize` | No | Size to which you want to scale the cropped image |
-| `resizeMode` | No | Resizing mode to use when scaling the image (iOS only, Android resize mode is always 'cover', Web - no support) **Default value**: 'contain' |
+| `resizeMode` | No | Resizing mode to use when scaling the image (iOS only, Android resize mode is always `'cover'`, Web - no support) **Default value**: `'cover'` |
| `quality` | No | The quality of the resulting image, expressed as a value from `0.0` to `1.0`.
The value `0.0` represents the maximum compression (or lowest quality) while the value `1.0` represents the least compression (or best quality).
iOS supports only `JPEG` format, while Android/Web supports both `JPEG`, `WEBP` and `PNG` formats.
**Default value**: `0.9` |
| `format` | No | The format of the resulting image, possible values are `jpeg`, `png`, `webp`.
**Default value**: based on the provided image; if value determination is not possible, `jpeg` will be used as a fallback.
`webp` isn't supported by iOS. |
diff --git a/ios/RNCImageEditor.mm b/ios/RNCImageEditor.mm
index d02b477..01e9eb6 100644
--- a/ios/RNCImageEditor.mm
+++ b/ios/RNCImageEditor.mm
@@ -24,6 +24,7 @@
#endif
#define DEFAULT_COMPRESSION_QUALITY 0.9
+#define DEFAULT_RESIZE_MODE "cover"
@implementation RNCImageEditor
@@ -59,7 +60,7 @@ - (void) cropImage:(NSString *)uri
// in pixels
displaySize = [RCTConvert CGSize:@{ @"width": @(rawDisplaySize.width()), @"height": @(rawDisplaySize.height()) }];
}
- RCTResizeMode resizeMode = [RCTConvert RCTResizeMode:data.resizeMode() ?: @"contain"];
+ RCTResizeMode resizeMode = [RCTConvert RCTResizeMode:data.resizeMode() ?: @(DEFAULT_RESIZE_MODE)];
NSURLRequest *imageRequest = [NSURLRequest requestWithURL:[NSURL URLWithString: uri]];
CGFloat compressionQuality = DEFAULT_COMPRESSION_QUALITY;
if (data.quality().has_value()) {
@@ -74,7 +75,7 @@ - (void) cropImage:(NSString *)uri
NSString *format = cropData[@"format"];
CGSize size = [RCTConvert CGSize:cropData[@"size"]];
CGPoint offset = [RCTConvert CGPoint:cropData[@"offset"]];
- RCTResizeMode resizeMode = [RCTConvert RCTResizeMode:cropData[@"resizeMode"] ?: @"contain"];
+ RCTResizeMode resizeMode = [RCTConvert RCTResizeMode:cropData[@"resizeMode"] ?: @(DEFAULT_RESIZE_MODE)];
CGSize displaySize = CGSizeZero;
BOOL hasDisplaySizeValue = cropData[@"displaySize"];
if(hasDisplaySizeValue){
diff --git a/src/types.ts b/src/types.ts
index 8647b38..47da088 100644
--- a/src/types.ts
+++ b/src/types.ts
@@ -5,7 +5,7 @@ type ImageCropDataFromSpec = Parameters[1];
export interface ImageCropData
extends Omit {
format?: 'png' | 'jpeg' | 'webp';
- resizeMode?: 'contain' | 'cover' | 'stretch';
+ resizeMode?: 'contain' | 'cover' | 'stretch' | 'center';
// ^^^ codegen doesn't support union types yet
// so to provide more type safety we override the type here
}