DylanVann / react-native-fast-image

🚩 FastImage, performant React Native image component.
MIT License
8.09k stars 1.47k forks source link

Is there has any option of no loop? #942

Closed ireneeming closed 1 year ago

ireneeming commented 1 year ago

Describe the bug

I am using this library to play gif image for splash screen, but I want to play this gif at once. Also, my gif image is just play one time, not loop. but when it shows in splash screen by using , it keep looping.

is there has any option to play it only once? not looping?

<FastImage
        style={{ width: 250, height: 100, marginBottom: 50 }}
        source={require('@images/lottie/splash-1.gif')}
        resizeMode={FastImage.resizeMode.contain}
      />
adeteejay commented 1 year ago

Im assuming you'd set that in lottie before eporting your gif. My personal advise would be to use if you can lottie-react-native. you'll have more control over the element and animations that way.

ireneeming commented 1 year ago

@adeteejay Thank you for the advise!

I just figured out this just by using an original in react-native. gif is fine working without using any other library..! Tnx!

Thinh-Vertex commented 1 year ago

@ireneeming could you show more detail about your resolve? I using image from react-native, it's still repeat animation on both android and ios

ireneeming commented 1 year ago

@ireneeming could you show more detail about your resolve? I using image from react-native, it's still repeat animation on both android and ios

@Thinh-Vertex Hello! Please check these two.

  1. did you add some code in android/app/build.gradle ? here's the references: https://reactnative.dev/docs/image#gif-and-webp-support-on-android
  2. your original gif file should not be infinite loop gif. mine gif file play only once not looping.
Thinh-Vertex commented 1 year ago

@ireneeming Thank you so much. I just resolved by same way with you :)

touchalex commented 1 year ago

I added "implementation 'com.facebook.fresco:animated-gif:2.5.0'" to the android dependencies. And made the GIF file to loop once only. It loop once only on iOS but still keep looping on Android.

However, I try not to use fastimage and use the default react native image. It works on both platform.

KishorJena commented 5 months ago

Im assuming you'd set that in lottie before eporting your gif. My personal advise would be to use if you can lottie-react-native. you'll have more control over the element and animations that way.

can lottie show gif and animated webp using image file uri which are stored on device ?