Skip to content

Commit 6062459

Browse files
author
farfromrefug
committed
fix: allow only decodeWidth or decodeHeight to be specified
1 parent 0940ba8 commit 6062459

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/image/platforms/android/java/com/nativescript/image/DraweeView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ public void setUri(android.net.Uri uri, String jsonOptions, com.facebook.drawee.
288288
int decodeWidth = object.optInt("decodeWidth");
289289
int decodeHeight = object.optInt("decodeHeight");
290290

291-
if (decodeWidth > 0 && decodeHeight > 0) {
292-
requestBuilder = requestBuilder.setResizeOptions(new com.facebook.imagepipeline.common.ResizeOptions(decodeWidth, decodeHeight));
291+
if (decodeWidth > 0 || decodeHeight > 0) {
292+
requestBuilder = requestBuilder.setResizeOptions(new com.facebook.imagepipeline.common.ResizeOptions(decodeWidth > 0 ? decodeWidth : decodeHeight, decodeHeight > 0 ? decodeHeight : decodeWidth));
293293
}
294294
int blurRadius = object.optInt("blurRadius", 0);
295295
if (blurRadius > 0) {

src/image/index.ios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ export class Img extends ImageBase {
454454
}
455455
if (this.decodeWidth || this.decodeHeight) {
456456
//@ts-ignore
457-
transformers.push(NSImageDecodeSizeTransformer.transformerWithDecodeWidthDecodeHeight(this.decodeWidth, this.decodeHeight));
457+
transformers.push(NSImageDecodeSizeTransformer.transformerWithDecodeWidthDecodeHeight(this.decodeWidth || this.decodeHeight, this.decodeHeight || this.decodeWidth));
458458
}
459459
if (this.tintColor) {
460460
transformers.push(SDImageTintTransformer.transformerWithColor(this.tintColor.ios));

0 commit comments

Comments
 (0)