-
Notifications
You must be signed in to change notification settings - Fork 1.2k
add onError event and wire image load failure to it #1687
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
Conversation
| _height = height; | ||
| } | ||
|
|
||
| /// <summary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small alignment #Resolved
| return "topLoadStart"; | ||
| case OnLoad: | ||
| return "topLoad"; | ||
| case OnLoadEnd: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we do with this one, then? Doesn't seem to be used.
Semantically "onLoad" marks the end, anyway.
[edit]: Based on the comments of the JS counterpart, onLoadEnd should be called in both cases (error & success).
So order for success:
- onLoadstart, onLoad, onLoadEnd
for failure: - onLoadStart, onError, onLoadEnd
(not sure about the order of onLoadEnd vs onXXX, perhaps peeking into Android code would inspire somehow.) #Resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated to fire both events as on android #Resolved
| if (_eventType == OnError) | ||
| { | ||
| eventData = new JObject(); | ||
| eventData.Add("error", _error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use object initializer:
eventData = new JObject
{
{ "error", _error }
};
``` #Resolved
|
You should consider sending a similar PR to send the error message on Android. |
|
@rozele Actually they dispatch from here: https://github.com/facebook/react-native/blob/master/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.java And yes, it's first onload/onerror, THEN onLoadEnd. #Resolved |
f4ccb54 to
278adce
Compare
reseul
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
![]()
# Conflicts: # ReactWindows/ReactNative.Shared/Views/Image/ReactImageLoadEvent.cs
(cherry picked from commit 63322df)
No description provided.