How do I display an animated gif in React Native?

前端 未结 8 1185
逝去的感伤
逝去的感伤 2020-12-02 22:10

How can I display an animated gif in react native. This is what I\'ve tried.

It works fine with a .

8条回答
  •  囚心锁ツ
    2020-12-02 22:54

    For Android You Need to Add Facebook's Fresco Library

    React Native does not come with Gif support out of the box but you can add Facebook's Fresco library to add this support.

    You should be able to simply add the following to your build.gradle file:

    compile 'com.facebook.fresco:animated-gif:0.+'
    

    Specific Version Compatibility

    If you are having troubles or you want to use a static version (highly recommended), you can simply go to the following React Native documentation page and replace the 0.46 in the URL with the version of React Native you're running:

    https://facebook.github.io/react-native/docs/0.46/image.html#gif-and-webp-support-on-android

提交回复
热议问题