Skip to content

Commit

Permalink
Fixes renderingMode not applied to GIF images (#24794)
Browse files Browse the repository at this point in the history
Summary:
Bugs like #24789, we don't apply tintColor to GIF. We fixes it by setting a poster image before add animation.

cc. cpojer .

[iOS] [Fixed] - Fixes renderingMode not applied to GIF images
Pull Request resolved: #24794

Differential Revision: D15316913

Pulled By: cpojer

fbshipit-source-id: 611a07ec17afc962d1eb6b8fc193f118fa623e73
  • Loading branch information
zhongwuzw authored and facebook-github-bot committed May 13, 2019
1 parent da7d3df commit 75380aa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Libraries/Image/RCTImageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,16 @@ - (void)imageLoaderLoadedImage:(UIImage *)loadedImage error:(NSError *)error for
self->_pendingImageSource = nil;
}

[self->_imageView.layer removeAnimationForKey:@"contents"];
if (image.reactKeyframeAnimation) {
CGImageRef posterImageRef = (__bridge CGImageRef)[image.reactKeyframeAnimation.values firstObject];
if (!posterImageRef) {
return;
}
// Apply renderingMode to animated image.
self->_imageView.image = [[UIImage imageWithCGImage:posterImageRef] imageWithRenderingMode:self->_renderingMode];
[self->_imageView.layer addAnimation:image.reactKeyframeAnimation forKey:@"contents"];
} else {
[self->_imageView.layer removeAnimationForKey:@"contents"];
self.image = image;
}

Expand Down

0 comments on commit 75380aa

Please sign in to comment.