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
This commit is contained in:
chrisnojima
2019-02-06 17:43:11 +01:00
committed by Mike Grabowski
parent 0bb1ba8ad5
commit 5e875474ef
+2 -2
View File
@@ -32,7 +32,7 @@ RCT_EXPORT_MODULE()
{
CGImageSourceRef imageSource = CGImageSourceCreateWithData((CFDataRef)imageData, NULL);
NSDictionary<NSString *, id> *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 @@ RCT_EXPORT_MODULE()
loopCount += 1;
}
}
UIImage *image = nil;
size_t imageCount = CGImageSourceGetCount(imageSource);
if (imageCount > 1) {