Skip to content

Commit 17aa1e3

Browse files
Fix image loop counter on iOS 14 (#30744)
Summary: Animated gifs, which do not loop, currently animate twice on iOS 14. See: #30147 ## Changelog [iOS] [Fixed] - Animated images without loop no longer animate twice Pull Request resolved: #30744 Test Plan: Run the example app with any animated gif. I attached a gif, which is affected. ![checkmark](https://user-images.githubusercontent.com/54310840/104746529-b2e02900-574f-11eb-9870-0c03c769c990.gif) Reviewed By: sammy-SC Differential Revision: D25977626 Pulled By: PeteTheHeat fbshipit-source-id: 889d4a7bed8f7a7be6a9a427501d0071b7c02b8c
1 parent 768ecc2 commit 17aa1e3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Libraries/Image/RCTAnimatedImage.m

+6-3
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,12 @@ - (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++;
90+
if (@available(iOS 14, *)) {
91+
} else {
92+
// A loop count of 1 means it should animate twice, 2 means, thrice, etc.
93+
if (loopCount != 0) {
94+
loopCount++;
95+
}
9396
}
9497
}
9598
}

0 commit comments

Comments
 (0)