Display animated gif


#1

According to the React Native docs (https://facebook.github.io/react-native/docs/image.html), you need to add fresco to the Android gradle file in order for animated gifs to work. The Expo app that I created doesn’t have an Android / iOS folder, which means there is no Android gradle file. How can I get animated gifs working with Expo?

Thanks


#2

we add it so gifs just work out of the box, go ahead and use one!


#3

It’s not working for me :frowning: I’m attempting to load them remotely, but nothing is appearing in my app. This is my code:

import React, { Component } from 'react';
import { Text, View, Image } from 'react-native';

import Styles from '../assets/stylesheets';

export default class ActivityListTableRow extends Component {
  render() {
    const { activity } = this.props;
    return (
      <View style={Styles.activityListRowContainer}>
        <Image
          source={{uri: activity.image_url}}
          style={Styles.activityListRowBackground} />
        <Text style={Styles.activityListRowHashTag}>{activity.hash_tag}</Text>
      </View>
    );
  }
}

If I change the Image to Text it displays the activity.image_url, so I know the URL exists and is correct. Is there something else I need to do for an animated gif?


#4

it’s some bug in your code probably! is the style what you expect it to be? defined width/height. is the image_url null or undefined or incorrect?


#5

https://snack.expo.io/rko5a7RyM


#6

Ah hah, I didn’t explicitly specify a width and height. It’s working now, thanks!