Skip to content

Commit 75380aa

Browse files
zhongwuzwfacebook-github-bot
authored andcommitted
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
1 parent da7d3df commit 75380aa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Libraries/Image/RCTImageView.m

+7-1
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,16 @@ - (void)imageLoaderLoadedImage:(UIImage *)loadedImage error:(NSError *)error for
363363
self->_pendingImageSource = nil;
364364
}
365365

366+
[self->_imageView.layer removeAnimationForKey:@"contents"];
366367
if (image.reactKeyframeAnimation) {
368+
CGImageRef posterImageRef = (__bridge CGImageRef)[image.reactKeyframeAnimation.values firstObject];
369+
if (!posterImageRef) {
370+
return;
371+
}
372+
// Apply renderingMode to animated image.
373+
self->_imageView.image = [[UIImage imageWithCGImage:posterImageRef] imageWithRenderingMode:self->_renderingMode];
367374
[self->_imageView.layer addAnimation:image.reactKeyframeAnimation forKey:@"contents"];
368375
} else {
369-
[self->_imageView.layer removeAnimationForKey:@"contents"];
370376
self.image = image;
371377
}
372378

0 commit comments

Comments
 (0)