Skip to content

Commit

Permalink
fix display problems when image fails to load (#25969)
Browse files Browse the repository at this point in the history
Summary:
This problem was also affecting Fabric and was fixed in D16708532.
When the image resource is changed and the new image resource fails to load, we expect the display image to fail to load, but the image still shows the image that was successfully loaded last time.

## Changelog

[iOS] [Fixed] - fix display problems when image fails to load
Pull Request resolved: #25969

Test Plan:
This is catalyst playground with following code P78264143.
TLDR of the code, it sets URL <Image> that is 404.

{F175486515}

Reviewed By: makovkastar

Differential Revision: D16783330

Pulled By: sammy-SC

fbshipit-source-id: 1cb488590ce15d957357f32a73ebf8df6cccf4cd
  • Loading branch information
jsfu authored and facebook-github-bot committed Aug 14, 2019
1 parent 639da37 commit 71d7d68
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Libraries/Image/RCTImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,10 @@ - (void)imageLoaderLoadedImage:(UIImage *)loadedImage error:(NSError *)error for
}

if (error) {
RCTExecuteOnMainQueue(^{
self.image = nil;
});

if (_onError) {
_onError(@{ @"error": error.localizedDescription });
}
Expand Down

0 comments on commit 71d7d68

Please sign in to comment.