DylanVann / react-native-fast-image

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

Broken image URL's break entire app (memory spikes and no error handling) #635

Open klaaz0r opened 4 years ago

klaaz0r commented 4 years ago

Describe the bug When using images from third party services sometimes the links are broken. This should not break the code/app. I see huge memory spikes (1gb+) when loading images that are broken. It is not possible to handle these broken images correctly. onError does not give a proper error and it is not possible to handle.

To Reproduce Load images with status codes other than 200, so a 403, 404 any 500 range or an broken link that returns a string/text.

Expected behavior onError should provide an error that can be handled inside the JS runtime.

Dependency versions

For now I am using the fallback (so react natives Image component) but I would love to use fast-image because well when it works it is amazing!

ahartzog commented 4 years ago

@klaaz0r can you explain how you're using Image as the fallback to prevent this behavior on broken/invalid URLs?

nobodyabcd commented 4 years ago

@klaaz0r can you explain how you're using Image as the fallback to prevent this behavior on broken/invalid URLs?

He means he didnt use fast-image because of this bug, he is using image

klaaz0r commented 4 years ago

@ahartzog what @guanhuay says, I use the fallback for now to prevent crashes. What I noticed is that it sometimes crashes when the image is used twice in the same view in different sizes, this might has something todo with it.

bradyim commented 4 years ago

@klaaz0r do you know if this is fixed in version 8.x.x?

efstathiosntonas commented 4 years ago

I guess this should fix it but it would require fallback prop: (fix released on rn 0.63)

https://github.com/facebook/react-native/commit/06b8b15b0af84b6f8b44d200dc25f29eac51181c