From 6f2e6f170e3ee785d1ba844971447ea24f91185e Mon Sep 17 00:00:00 2001 From: zhongwuzw Date: Wed, 28 Aug 2019 08:13:27 -0700 Subject: [PATCH] Fixes animated gifs incorrectly looping (#25612) Summary: [After migrate to new GIF implementation](https://github.com/facebook/react-native/pull/24822), we need to do some cleanup, before, we already unify the gif loop count between iOS and Android, more details please see https://github.com/facebook/react-native/pull/21999, so let's unify it again. ## Changelog [iOS] [Fixed] - Fixes animated gifs incorrectly looping Pull Request resolved: https://github.com/facebook/react-native/pull/25612 Test Plan: example gif should repeat playback twice. ``` ``` Reviewed By: sammy-SC Differential Revision: D16280067 Pulled By: osdnk fbshipit-source-id: 2351499855f1e0e97c358fa0b3544dd2cc0cf703 --- Libraries/Image/RCTAnimatedImage.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Libraries/Image/RCTAnimatedImage.m b/Libraries/Image/RCTAnimatedImage.m index 2cabc1c648e9a3..60cdddfa4ac526 100644 --- a/Libraries/Image/RCTAnimatedImage.m +++ b/Libraries/Image/RCTAnimatedImage.m @@ -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;