Skip to content
Permalink
Browse files

Fixes renderingMode not applied to GIF images (#24794)

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 75380aa3296210777dc0be70a722701767276117
Showing with 7 additions and 1 deletion.
  1. +7 −1 Libraries/Image/RCTImageView.m
@@ -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;
}

0 comments on commit 75380aa

Please sign in to comment.
You can’t perform that action at this time.