question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Image animation (changing images) didnt' work on IOS

See original GitHub issue

Hi i try to animation image i have 2 images and i change it after 1 second in a loop but i don’t in ios frame change but image remain the same and in Android it works fine. Can any one help me? componentDidMount() {

setInterval(() => {
    var imageIndex = this.state.imageIndex+1;
      if (imageIndex >= animationImages.length) {
          imageIndex = 0;
      }
      this.setState({imageIndex:imageIndex})
    }, 1000);
}

above is how i run it in loop and below is how i change the image

<Image
                style={styles.happyCatContainer}
                source={animationImages[this.state.imageIndex]}/>

and this is how i declare images on top

const animationImages = [
        require('./Resources/onboarding_messages/happyCat1.png'),
        require('./Resources/onboarding_messages/happyCat2.png'),
    ]

this works in android but ios just frame updated image remain the same.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
asciimancommented, Aug 8, 2016

The key was adding a “key”. 😃

<Image source={icon} key={icon} />

Now the image is reloading.

0reactions
facebook-github-botcommented, Nov 14, 2016

@charpeni tells me to close this issue. If you think it should still be opened let us know why.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to animate the change of image in an UIImageView?
Your code worked perfectly when going from one image to another. Do you know how to make it work with automatic animation of...
Read more >
Fixed issues in Animate release - Adobe Support
We heard you! We've been working hard at fixing the issues you reported to us. Here's a list of issues we fixed in...
Read more >
Convert live photos to video | Adobe
Introduced in 2015 with the iPhone 6S, Live Photos are animated pictures, ... as your mobile device has iOS 11, you can still...
Read more >
Create a picture-in-picture effect in iMovie on Mac
Apply an effect to the picture-in-picture clip: Click the transition style pop-up menu and choose Dissolve, Zoom, or Swap. Choosing Swap makes the...
Read more >
The animated graphic in my e-mail message doesn't work
When you receive an e-mail message that contains animated graphics, such as animated .gif files, only a static image appears.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found