DylanVann / react-native-fast-image

🚩 FastImage, performant React Native image component.
MIT License
8.2k stars 1.51k forks source link

Methods don't work on Android #391

Open talentedev opened 5 years ago

talentedev commented 5 years ago

I used spinner while image is loading by using onLoadEnd() method. It worked on iOS. But it doesn't work on Android.

{isLoadedImage === false ? (
          <Spinner color={Colors.brandPrimary} style={Styles.spinner} />
        ) : null}
        <FastImage
          style={isLoadedImage ? Styles.thumb : [Styles.thumb, Styles.hidden]}
          source={{
            uri: photoUrl,
            priority: FastImage.priority.high,
          }}
          onLoadEnd={() => this.setState({ isLoadedImage: true })}
        />

So I tried to use other methods : onLoadStart(), onProgress(), onLoad(). I found that only onLoadStart() method works.

wuifdesign commented 5 years ago

i'm having the same problem. i think this happens if you set the width/height of the FastImage to 0.

tnortman commented 5 years ago

@wuifdesign Yep - I can confirm that if I set width/height to 0, the onLoad callback is never fired

cctanfujun commented 5 years ago

fixed it in https://github.com/DylanVann/react-native-fast-image/pull/446

afeichuanqi commented 5 years ago

将其修复为#446

Using this component in Android will find performance issues with fps reduction. Have you ever encountered it?