Skip to content

Commit

Permalink
Merge pull request #7414 from Expensify/Rory-FixImageResizing
Browse files Browse the repository at this point in the history
[CP Stg] Resolve getImageSize promise with an object instead of multiple values

(cherry picked from commit 87eda2a)
  • Loading branch information
marcaaron authored and OSBotify committed Jan 26, 2022
1 parent 219591a commit 97f201c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/ImageWithSizeCalculation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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;
Expand Down

0 comments on commit 97f201c

Please sign in to comment.