Skip to content

Commit

Permalink
Cancel contents animation before setting new contents in RCTNetworkIm…
Browse files Browse the repository at this point in the history
…ageView

Summary:
This is a fix for facebook#322

When setting a new image via the imageURL property, the new image
doesn't always replace the previous one when it is finished downloading
because the image view has a previously instated layer animation
on its contents. This cancels any animation prior to setting the new
contents to fix the issue.
Closes facebook#337
Github Author: Julius Parishy <julius>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
  • Loading branch information
Julius Parishy committed Mar 27, 2015
1 parent 9bcec52 commit 7817e8e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Libraries/Image/RCTNetworkImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ - (void)setImageURL:(NSURL *)imageURL resetToDefaultImageWhileLoading:(BOOL)rese
} else {
_downloadToken = [_imageDownloader downloadImageForURL:imageURL size:self.bounds.size scale:RCTScreenScale() block:^(UIImage *image, NSError *error) {
if (image) {
[self.layer removeAnimationForKey:@"contents"];
self.layer.contentsScale = image.scale;
self.layer.contents = (__bridge id)image.CGImage;
}
Expand Down

0 comments on commit 7817e8e

Please sign in to comment.