diff --git a/Libraries/Image/RCTImageView.m b/Libraries/Image/RCTImageView.m index 0e5e913317cf2f..e2f221ba85a998 100644 --- a/Libraries/Image/RCTImageView.m +++ b/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; }