Display animated gif

According to the React Native docs (Image · React Native), 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

1 Like

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

1 Like

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?

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?

1 Like

https://snack.expo.io/rko5a7RyM

1 Like

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

2 Likes

Abri o seu link deu erro

eu cometei

  paddingTop: Constants.statusBarHeight,
 e import { Constants } from 'expo';

e rolou, o seu código foi útil para colocar gif no app… e fiz um Loading incrível.

obrigada 0/