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

since ios 14, animated gif without loop are rendered twice #30147

Closed
macartigan opened this issue Oct 9, 2020 · 16 comments
Closed

since ios 14, animated gif without loop are rendered twice #30147

macartigan opened this issue Oct 9, 2020 · 16 comments
Labels
API: Animated Needs: Triage 🔍 Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@macartigan
Copy link

bug ios gif

Description

since ios 14, animated gif without loop are rendered twice

React Native version:

"react-native": "^0.63.2" and ios 14

Steps To Reproduce

use a gif without loops and use it like:
<Image source=

Expected Results

run the gif without the second loop

@comvenger-brandon
Copy link
Contributor

Same issue here on 0.63.3 with iOS14.

@quyetthang122
Copy link

I am having same issue with IOS 14

@leothierry
Copy link

+1 Also same issue on 0.63.3 with iOS14

@sopranolinist
Copy link

I did a bit of digging into the ios animated image code and found that if I changed this:

      // A loop count of 1 means it should repeat twice, 2 means, thrice, etc.
      if (loopCount != 0) {
        loopCount++;
      }

to this:

      if(@available(iOS 14, *)) {
      } else {
      // A loop count of 1 means it should repeat twice, 2 means, thrice, etc.
        if (loopCount != 0) {
          loopCount++;
        }
      }

then my animated gif renders only once on iOS 14 and still renders only once (as it always has) on iOS 13.7 as well. Maybe something changed with the way that gifLoopCount is calculated in iOS 14?

@grcekh
Copy link

grcekh commented Nov 17, 2020

FWIW - this is the only thread I could find on this, but I was having the same issue with a non-looping gif rendering twice in a web project (not React or React Native). It was happening in both Safari and Chrome on my iOS 14 device until I updated to iOS 14.2 last night, and that resolved the issue for me.

@hkar19
Copy link

hkar19 commented Dec 29, 2020

I did a bit of digging into the ios animated image code and found that if I changed this:

      // A loop count of 1 means it should repeat twice, 2 means, thrice, etc.
      if (loopCount != 0) {
        loopCount++;
      }

to this:

      if(@available(iOS 14, *)) {
      } else {
      // A loop count of 1 means it should repeat twice, 2 means, thrice, etc.
        if (loopCount != 0) {
          loopCount++;
        }
      }

then my animated gif renders only once on iOS 14 and still renders only once (as it always has) on iOS 13.7 as well. Maybe something changed with the way that gifLoopCount is calculated in iOS 14?

can you explain how this line if(@available(iOS 14, *)) works?

@comvenger-brandon
Copy link
Contributor

comvenger-brandon commented Jan 15, 2021

I did a bit of digging into the ios animated image code and found that if I changed this:

      // A loop count of 1 means it should repeat twice, 2 means, thrice, etc.
      if (loopCount != 0) {
        loopCount++;
      }

to this:

      if(@available(iOS 14, *)) {
      } else {
      // A loop count of 1 means it should repeat twice, 2 means, thrice, etc.
        if (loopCount != 0) {
          loopCount++;
        }
      }

then my animated gif renders only once on iOS 14 and still renders only once (as it always has) on iOS 13.7 as well. Maybe something changed with the way that gifLoopCount is calculated in iOS 14?

can you explain how this line if(@available(iOS 14, *)) works?

loopCount is not increased on iOS 14 or higher.
https://developer.apple.com/documentation/swift/objective-c_and_c_code_customization/marking_api_availability_in_objective-c

https://docs.swift.org/swift-book/LanguageGuide/ControlFlow.html#//apple_ref/doc/uid/TP40014097-CH9-ID523

I went ahead and created a pull request.

facebook-github-bot pushed a commit that referenced this issue Jan 21, 2021
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
@DheerajGussain
Copy link

DheerajGussain commented Feb 16, 2021

I did a bit of digging into the ios animated image code and found that if I changed this:

      // A loop count of 1 means it should repeat twice, 2 means, thrice, etc.
      if (loopCount != 0) {
        loopCount++;
      }

to this:

      if(@available(iOS 14, *)) {
      } else {
      // A loop count of 1 means it should repeat twice, 2 means, thrice, etc.
        if (loopCount != 0) {
          loopCount++;
        }
      }

then my animated gif renders only once on iOS 14 and still renders only once (as it always has) on iOS 13.7 as well. Maybe something changed with the way that gifLoopCount is calculated in iOS 14?

changing the above code does not work on my project, still animating twice in ios 14.4,
attaching the gif and the video how it behaves on the app

https://user-images.githubusercontent.com/38404135/108080357-c73c7c00-7095-11eb-839b-1c8bcda3cc20.mov
vid-7

@hkar19
Copy link

hkar19 commented Mar 5, 2021

I did a bit of digging into the ios animated image code and found that if I changed this:

      // A loop count of 1 means it should repeat twice, 2 means, thrice, etc.
      if (loopCount != 0) {
        loopCount++;
      }

to this:

      if(@available(iOS 14, *)) {
      } else {
      // A loop count of 1 means it should repeat twice, 2 means, thrice, etc.
        if (loopCount != 0) {
          loopCount++;
        }
      }

then my animated gif renders only once on iOS 14 and still renders only once (as it always has) on iOS 13.7 as well. Maybe something changed with the way that gifLoopCount is calculated in iOS 14?

changing the above code does not work on my project, still animating twice in ios 14.4,
attaching the gif and the video how it behaves on the app

Screen.Recording.2021-02-16.at.8.24.35.PM.mov

are you sure that modal is gif?

and have you tried to rebuild your app after you change the module?

@aaron0215
Copy link

Any update on this issue? Or any official fix is done?

@noamyagil
Copy link

Same here animated gifs animate *2

@cojoclaudiu
Copy link

Same in iOS 14.5 and android

@stale
Copy link

stale bot commented Jan 9, 2022

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 9, 2022
@EMDirks
Copy link

EMDirks commented Jan 9, 2022 via email

@stale stale bot removed the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 9, 2022
@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Aug 17, 2023
@github-actions
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: Animated Needs: Triage 🔍 Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests