How to display GIF in react-native android app?

前端 未结 8 2117
醉梦人生
醉梦人生 2020-12-01 13:50

I want to display a simple gif via URL in my Image tag in my android react-native app but when I start it no image is shown. The code as provided in the docs does work only

8条回答
  •  遥遥无期
    2020-12-01 14:31

    From React Native Docs:

    When building your own native code, GIF and WebP are not supported by default on Android.

    You will need to add some optional modules in android/app/build.gradle, depending on the needs of your app.

    dependencies {
      // If your app supports Android versions before Ice Cream Sandwich (API level 14)
      implementation 'com.facebook.fresco:animated-base-support:1.3.0'
    
      // For animated GIF support
      implementation 'com.facebook.fresco:animated-gif:2.0.0'
    
      // For WebP support, including animated WebP
      implementation 'com.facebook.fresco:animated-webp:2.1.0'
      implementation 'com.facebook.fresco:webpsupport:2.0.0'
    
      // For WebP support, without animations
      implementation 'com.facebook.fresco:webpsupport:2.0.0'
    }
    

提交回复
热议问题