Skip to content

Commit 6f2e6f1

Browse files
zhongwuzwfacebook-github-bot
authored andcommitted
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
1 parent 44bfc4b commit 6f2e6f1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Libraries/Image/RCTAnimatedImage.m

+4
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ - (NSUInteger)imageLoopCountWithSource:(CGImageSourceRef)source
8787
NSNumber *gifLoopCount = gifProperties[(__bridge NSString *)kCGImagePropertyGIFLoopCount];
8888
if (gifLoopCount != nil) {
8989
loopCount = gifLoopCount.unsignedIntegerValue;
90+
// A loop count of 1 means it should repeat twice, 2 means, thrice, etc.
91+
if (loopCount != 0) {
92+
loopCount++;
93+
}
9094
}
9195
}
9296
return loopCount;

0 commit comments

Comments
 (0)