React Native Android中的Gif支持 [英] Gif support in React Native Android

查看:171
本文介绍了React Native Android中的Gif支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android的React Native不支持GIF吗? 如果要添加gif支持,该怎么办?

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

推荐答案

默认情况下,android react native应用程序不支持Gif图像. 您需要设置以下代码来显示gif图像. 代码: 打开您的android/app/build.gradle文件,在

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'  

然后您需要再次捆绑该应用程序.您可以通过两种方式显示gif图像.

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,

这篇关于React Native Android中的Gif支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆