Skip to content
Permalink
Browse files
Fixes animated gifs incorrectly looping (#25612)
Summary:
[After migrate to new GIF implementation](#24822), we need to do some cleanup, before, we already unify the gif loop count between iOS and Android, more details please see #21999, so let's unify it again.

## Changelog

[iOS] [Fixed] - Fixes animated gifs incorrectly looping
Pull Request resolved: #25612

Test Plan:
example gif should repeat playback twice.
```
        <Image
          style={styles.gif}
          source={{uri: "https://user-images.githubusercontent.com/475235/47662061-77011f00-db57-11e8-904f-a1824912ace9.gif"}}
        />
```

Reviewed By: sammy-SC

Differential Revision: D16280067

Pulled By: osdnk

fbshipit-source-id: 2351499855f1e0e97c358fa0b3544dd2cc0cf703
  • Loading branch information
zhongwuzw authored and facebook-github-bot committed Aug 28, 2019
1 parent 44bfc4b commit 6f2e6f170e3ee785d1ba844971447ea24f91185e
Showing 1 changed file with 4 additions and 0 deletions.
@@ -87,6 +87,10 @@ - (NSUInteger)imageLoopCountWithSource:(CGImageSourceRef)source
NSNumber *gifLoopCount = gifProperties[(__bridge NSString *)kCGImagePropertyGIFLoopCount];
if (gifLoopCount != nil) {
loopCount = gifLoopCount.unsignedIntegerValue;
// A loop count of 1 means it should repeat twice, 2 means, thrice, etc.
if (loopCount != 0) {
loopCount++;
}
}
}
return loopCount;

0 comments on commit 6f2e6f1

Please sign in to comment.