React-native-fast-image: Replacing Animated.Image

Created on 22 Nov 2017  路  7Comments  路  Source: DylanVann/react-native-fast-image

Hi,

I am currently working on an animation using the standard Image tag, I would like to use FastImage for these images however Animated.FastImage obviously doesn't work.

Doesn't anyone know a way to get this working?

Most helpful comment

const AnimatedFastImage = Animated.createAnimatedComponent(FastImage);

All 7 comments

const AnimatedFastImage = Animated.createAnimatedComponent(FastImage);

@ahanriat I've tried this but I was not able to make it work - it shows blank (no image is shown).

<AnimatedFastImage
  style={[styles.image, { opacity: this.state.imageOpacity }, this.props.style]}
  source={{
    uri: this.props.imageSource,
    priority: FastImage.priority.normal,
  }}
  resizeMode={FastImage.resizeMode.cover}
  onLoad={() => this.onLoadImage()} //function call to Animated.timing on this.state.imageOpacity
/>

@tyeon95 Did you set height or width to your image style?

There is a deeper issue with this where if the image is cached onLoad will not be called at all.

This actually works for me with const AnimatedImage = Animated.createAnimatedComponent(FastImage);

I believe all the involved issues have been resolved.

It works, but when you change height and width with animation, the image is pixelated.

Was this page helpful?
0 / 5 - 0 ratings