Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Support for Image onError #7440

Closed
MichaelDanielTom opened this issue May 7, 2016 · 9 comments
Closed

[Android] Support for Image onError #7440

MichaelDanielTom opened this issue May 7, 2016 · 9 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@MichaelDanielTom
Copy link

Hey Guys,

Will there be support for an onError callback on Image for Android? I want to set an error image if the image fails to load, without resorting to hacking around onLoad and onLoadEnd. If I'm overlooking an obvious easy way to do this please let me know :)

@brentvatne
Copy link
Collaborator

68b2f49 adds support for this to an extent, but it's not perfect -- it doesn't handle some cases like 404s which Fresco (the underlying image library) doesn't handle yet afaik, cc @tyronen

@ide
Copy link
Contributor

ide commented May 11, 2016

The Java implementation of Image.prefetch calls the rejection callback on error so Fresco might expose errors now, worth revisiting.

@ajoshdee
Copy link

Same with ios, i want to set default image onError, dunno how.

@atticoos
Copy link
Contributor

@ajoshdee, you'd need to make a component that handles the error, sets a state indicating there's an error, and then using that default image when an error exists

@SergeyKorochansky
Copy link
Contributor

SergeyKorochansky commented Aug 15, 2016

@brentvatne This 68b2f49 commit adds event dispatching, but JS component does not receive it (but onLoadEnd works great). Why it happens?

@lacker
Copy link
Contributor

lacker commented Nov 29, 2016

We closed the referenced pull request as "working as intended" so I think we should close this issue as well.

@lacker lacker closed this as completed Nov 29, 2016
@atticoos
Copy link
Contributor

@lacker it sounds like the conclusion there is that onError will not currently work on Android. Would prefer to keep an issue open for visibility, discussions, and future outlook

@lacker
Copy link
Contributor

lacker commented Nov 30, 2016

Our goal right now is to focus the github issues for bug reports - it had been months on this anyway with no activity. If someone has a proposal for how to fix this then I think it would be worth opening another issue to debate it.

@atticoos
Copy link
Contributor

Sounds good @lacker - thanks for explaining.

Dropping this here for anyone that comes seeking this issue, this is a solution we threw together to achieve the platform consistency:

https://github.com/robinpowered/react-native-android-image-polyfill
https://www.npmjs.com/package/react-native-android-image-polyfill

@facebook facebook locked as resolved and limited conversation to collaborators Jul 19, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

9 participants