Skip to content

Commit 935a263

Browse files
author
Veselina Radeva
committed
(feat): Make fitdefault option also for iOS. Bump version for breaking change
1 parent c3d85a9 commit 935a263

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Once image is picked some options can be applied to it before it is used:
130130
| --- | --- | --- |
131131
| maxWidth | null | Image max width |
132132
| maxHeight | null | Image max height |
133-
| iosAspectRatio | fill | iOS only. Possible values are `fit` and `fill`. [Read more](https://developer.apple.com/documentation/photos/phimagecontentmode) |
133+
| aspectRatio | fit | iOS only. Possible values are `fit` and `fill`. [Read more](https://developer.apple.com/documentation/photos/phimagecontentmode) |
134134
135135
## License
136136

demo/app/main-page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function startSelection(context, isSingle) {
3535
console.log("----------------");
3636
console.log("uri: " + selected.uri);
3737
if(isSingle){
38-
selected.getImage({ maxWidth: 200, maxHeight: 200, iosAspectRatio: 'fit' })
38+
selected.getImage({ maxWidth: 200, maxHeight: 200, aspectRatio: 'fill' })
3939
.then((imageSource) => {
4040
imageSrc.src = imageSource;
4141
});

src/imagepicker.ios.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const IMAGE_HEIGHT = 80;
1919
interface ImageOptions {
2020
maxWidth?: number;
2121
maxHeight?: number;
22-
iosAspectRatio?: "fill" | "fit";
22+
aspectRatio?: "fill" | "fit";
2323
}
2424

2525
export function create(options?): ImagePicker {
@@ -345,7 +345,7 @@ class ImagePickerPH extends ImagePicker {
345345
return new Promise<image_source.ImageSource>((resolve, reject) => {
346346
let size: CGSize = options ? CGSizeMake(options.maxWidth, options.maxHeight) : PHImageManagerMaximumSize;
347347
let resizeMode = PHImageRequestOptions.alloc().init();
348-
let aspectRatio = (options && options.iosAspectRatio && options.iosAspectRatio === 'fit') ? PHImageContentMode.AspectFit : PHImageContentMode.AspectFill;
348+
let aspectRatio = (options && options.aspectRatio && options.aspectRatio === 'fill') ? PHImageContentMode.AspectFill : PHImageContentMode.AspectFit;
349349

350350
// TODO: Decide whether it is benefical to use PHImageRequestOptionsResizeModeFast
351351
// Accuracy vs Performance. It is probably best to expose these as iOS specific options.

src/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export interface ImageOptions {
1414
maxHeight?: number;
1515

1616
/**
17-
* iOS only. The image aspect ratio. Default value: fill.
17+
* iOS only. The image aspect ratio. Default value: fit.
1818
*/
19-
iosAspectRatio?: "fill" | "fit";
19+
aspectRatio?: "fill" | "fit";
2020
}
2121

2222
export class SelectedAsset extends imageAssetModule.ImageAsset {

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-imagepicker",
3-
"version": "3.0.7",
3+
"version": "4.0.0",
44
"description": "A plugin for the NativeScript framework implementing multiple image picker",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)