York
York

Reputation: 523

Gif support in React Native Android

React Native of Android don't support GIF? If I want to add gif support, what should I do?

Upvotes: 1

Views: 1958

Answers (1)

Venkatesh Somu
Venkatesh Somu

Reputation: 5020

By default the Gif images are not supported in android react native app. You need to set the following code to display the gif images. The code: Open your android/app/build.gradle file add the following code in the place of

open android/app/build.gradle add the following  code 

dependencies: { 
  ...
     // For animated GIF support
    compile 'com.facebook.fresco:animated-base-support:0.11.0'  
    // For WebP support, including animated WebP
    compile 'com.facebook.fresco:animated-gif:0.11.0'  
    compile 'com.facebook.fresco:animated-webp:0.11.0' 
    compile  'com.facebook.fresco:webpsupport:0.11.0'  

then you need to bundle the app again, You can display the gif images in two ways like this.

   1-> <Image source={require('./../images/load.gif')}  style={{width: 100, height: 100 }}/>
   2-> <Image source={{uri: 'http://www.clicktorelease.com/code/gif/1.gif'}}  style={{width: 100, height:100 }}/>

I hope it is helpful to others,

Upvotes: 1

Related Questions