DylanVann / react-native-fast-image

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

Not rendering images in Android RN 0.70 #974

Open aubri61 opened 1 year ago

aubri61 commented 1 year ago

Describe the bug

I'm using fast image instead of default image component in react native. In some component, fast image works fine with Android but in others, such as after I fetch from unsplash api and get 20 of images, I can never see photos. Rarely, after like 10 minutes, i can see some of the photos. (1 out of 30 times) Everything is working fine with IOS.

here is my code

<TouchableOpacity onPress={() => props.onItemPress(item)}>
    <FastImage
          source={{uri: item.urls.small, priority: FastImage.priority.high}}
          style={{
          width: width / 2 - 25,
          height: (width / 2 - 25) * ratio,
          ...theme.shadow,
          borderRadius: 10,
          }}
          // resizeMode={FastImage.resizeMode.contain}
      />
    <View
        style={{
        width: width / 2 - 25,
        height: (width / 2 - 25) * ratio,
        // backgroundColor: '#00000010',
        position: 'absolute',
        borderRadius: 10,
        justifyContent: 'flex-end',
        paddingLeft: 5,
        paddingBottom: 5,
    }}>
    <Appreciates username={item.user.username} textStyle={{color: '#ffffff'}} />
    </View>
</TouchableOpacity>

and this is the working code..

<TouchableOpacity
    style={styles.itemContainer}>
    <FastImage source={{uri: props.image.url}} style={widthStyles.image} />
        <View style={widthStyles.coverView}>
            <Text style={styles.tagText}>{props.tags.join('\n')}</Text>
        </View>
</TouchableOpacity>

I tried some solutions in closed issues but didn't work.. I really need to use this library since I need caching function.. please help me out 🙏🏻

oh and i'm using android emulator!! is it just a problem of network? I don't think so because working one are also rendering images from unsplash. The difference is that one with the problem is using response data from fetch, while the other one uses static data.

Screenshots Bug screen from Android Bug screen from Android

expected screen from IOS expected screen from IOS

Dependency versions

JustinHarshbarger commented 1 year ago

I have the same issue, the image display is really random. Some appear after a while and some don't ever show. I'm running this on a Pixel 4a 5G with latest Android OS.

aubri61 commented 1 year ago

no any updates? :(

i found that i can't render images when i fetch the image url from api.. when i copy the url from the data and put it in the uri as a string value, it works.

Please solve this issue or anyone suffering from same issue, help me out :((( i really need this..

ilovinht commented 1 year ago

same issue +1 any updates?

kevindingens commented 1 year ago

+1, also experiencing this, commenting to get updates

leeseonghyun21 commented 1 year ago

same issue + 1 on RN 0.71.7 + FastImage@8.6.3.

adding this code works

fallback={true}
aubri61 commented 1 year ago

@leeseonghyun21 yeah, i am temporarily using fallback too, but i guess when i set fallback true, there not much reasons for using fast image since it uses default image component instead.. 🥲

leeseonghyun21 commented 1 year ago

@aubri61 that's right. If the fallback is true, the default Image component is used only when image fetching fails, so there will still be a performance advantage over not using FastImage at all.

It's hard to pinpoint exactly in which case this issue occurs, but since iOS renders the same image normally, I think it's an issue inside Glide(just guess lol).

I hope this problem can be solved quickly, and I hope that the error object can be passed as a parameter of the function in onError

T-Damer commented 7 months ago

Same for me and still no fix, fallback helps, but we need another solution