From 59ef1c518fefd0b2aacf77183e8dd2ee87c41239 Mon Sep 17 00:00:00 2001 From: Rory Abraham Date: Tue, 25 Jan 2022 16:32:13 -0800 Subject: [PATCH] Resolve getImageSize promise with an object instead of multiple values --- src/components/ImageWithSizeCalculation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ImageWithSizeCalculation.js b/src/components/ImageWithSizeCalculation.js index 4897b4cb1151..698da27c610e 100644 --- a/src/components/ImageWithSizeCalculation.js +++ b/src/components/ImageWithSizeCalculation.js @@ -56,7 +56,7 @@ class ImageWithSizeCalculation extends PureComponent { getImageSize(url) { return new Promise((resolve, reject) => { Image.getSize(url, (width, height) => { - resolve(width, height); + resolve({width, height}); }, (error) => { reject(error); }); @@ -70,7 +70,7 @@ class ImageWithSizeCalculation extends PureComponent { this.getImageSizePromise = makeCancellablePromise(this.getImageSize(this.props.url)); this.getImageSizePromise.promise - .then((width, height) => { + .then(({width, height}) => { if (!width || !height) { // Image didn't load properly return;