From 728a35fcf2a2b0d695a4d7083b266eda486b1392 Mon Sep 17 00:00:00 2001 From: chrisnojima Date: Tue, 15 Jan 2019 16:09:39 -0800 Subject: [PATCH] fix incorrect type which makes animated gifs not loop forever on device (#22987) Summary: https://github.com/facebook/react-native/issues/22985 This 1 liner fixes the animation looping being broken on ios devices. The original source of the bug is here: https://github.com/facebook/react-native/commit/95ef882#diff-e57b12f931820d7e0949e5cbb2701dcfR35 We set the value to a special large float, and assign it to repeatCount which is also a float, so this should be a float. Changelog: [iOS] [Fixed] - Fix animated GIFs not looping forever Pull Request resolved: https://github.com/facebook/react-native/pull/22987 Differential Revision: D13682645 Pulled By: hramos fbshipit-source-id: 96b0602b418e3ebe369427a24777cd4374ac5d48 --- Libraries/Image/RCTGIFImageDecoder.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/Image/RCTGIFImageDecoder.m b/Libraries/Image/RCTGIFImageDecoder.m index 0943493c9a283c..73fef5381a7c38 100644 --- a/Libraries/Image/RCTGIFImageDecoder.m +++ b/Libraries/Image/RCTGIFImageDecoder.m @@ -32,7 +32,7 @@ - (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData { CGImageSourceRef imageSource = CGImageSourceCreateWithData((CFDataRef)imageData, NULL); NSDictionary *properties = (__bridge_transfer NSDictionary *)CGImageSourceCopyProperties(imageSource, NULL); - NSUInteger loopCount = 0; + CGFloat loopCount = 0; if ([[properties[(id)kCGImagePropertyGIFDictionary] allKeys] containsObject:(id)kCGImagePropertyGIFLoopCount]) { loopCount = [properties[(id)kCGImagePropertyGIFDictionary][(id)kCGImagePropertyGIFLoopCount] unsignedIntegerValue]; if (loopCount == 0) { @@ -43,7 +43,7 @@ - (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData loopCount += 1; } } - + UIImage *image = nil; size_t imageCount = CGImageSourceGetCount(imageSource); if (imageCount > 1) {