Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] Fixes animated gifs incorrectly looping #25612

Closed
wants to merge 1 commit into from

Conversation

zhongwuzw
Copy link
Contributor

Summary

After migrate to new GIF implementation, 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

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"}}
        />

@zhongwuzw zhongwuzw requested a review from shergin as a code owner July 12, 2019 11:42
@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 12, 2019
@osdnk
Copy link
Contributor

osdnk commented Jul 16, 2019

Let's try

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@osdnk has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@@ -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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @zhongwuzw ,

I think we could simplify this, we could assign loopCount = 0 and then when returning from the function we could return loopCount + 1. This way we get rid of this condition. What do you think?

Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sammy-SC Emm, if we return loopCount + 1, the min value is 1? but we need to return 0 if gifLoopCount exist and its value is 0.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see :)

Thanks for fixing this.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @zhongwuzw in 6f2e6f1.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: Animated Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Platform: iOS iOS applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants