0

As can be seen from this snack, I embedded 2 identical animated gifs back to back.

The first one that loops for ever functions as expected.

But the second, the non-looping animated gif is lost when the application is sent to background and retrieved back to foreground.

Is there anything that can be done to avoid this?

import testAniGif from '../assets/test.gif';
import testAniGif2 from '../assets/test2.gif';

export default function AssetExample() {
  return (
    <View>
      <Image style={styles.logo} source={testAniGif} />
      <Image style={styles.logo} source={testAniGif2} />
    </View>
  );
}
Mehmet Kaplan
  • 1,723
  • 2
  • 20
  • 43

1 Answers1

0

I think you just need to implement proper syntax for Image attribute

<Image style={styles.logo} source={require(testAniGif)} />
<Image style={styles.logo} source={require(testAniGif2)} />

Have a look Image syntax https://reactnative.dev/docs/image

For better understanding you can follow this answer too : https://stackoverflow.com/a/40717686/3840093

Kirankumar Dafda
  • 2,354
  • 5
  • 29
  • 56