Skip to content

Commit

Permalink
fix incorrect type which makes animated gifs not loop forever on devi…
Browse files Browse the repository at this point in the history
…ce (#22987)

Summary:
#22985

This 1 liner fixes the animation looping being broken on ios devices. The original source of the bug is here: 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: #22987

Differential Revision: D13682645

Pulled By: hramos

fbshipit-source-id: 96b0602b418e3ebe369427a24777cd4374ac5d48
  • Loading branch information
chrisnojima authored and facebook-github-bot committed Jan 16, 2019
1 parent 3654b9e commit 728a35f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Libraries/Image/RCTGIFImageDecoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ - (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData
{
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) {
Expand All @@ -43,7 +43,7 @@ - (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData
loopCount += 1;
}
}

UIImage *image = nil;
size_t imageCount = CGImageSourceGetCount(imageSource);
if (imageCount > 1) {
Expand Down

0 comments on commit 728a35f

Please sign in to comment.