mirror of
https://github.com/status-im/react-native.git
synced 2025-01-30 03:05:44 +00:00
Improves react image loading handlers to mimic iOS behavior
Reviewed By: vjeux Differential Revision: D3283011 fbshipit-source-id: acb04f8b2ccbab99a59040a7ca70aa46cbf73faa
This commit is contained in:
parent
c1f0ce283c
commit
68b2f49a31
@ -26,7 +26,7 @@ public class ImageLoadEvent extends Event<ImageLoadEvent> {
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@interface ImageEventType {}
|
||||
|
||||
// Currently ON_ERROR and ON_PROGRESS are not implemented, these can be added
|
||||
// Currently ON_PROGRESS is not implemented, these can be added
|
||||
// easily once support exists in fresco.
|
||||
public static final int ON_ERROR = 1;
|
||||
public static final int ON_LOAD = 2;
|
||||
|
@ -193,10 +193,10 @@ public class ReactImageView extends GenericDraweeView {
|
||||
@Nullable Animatable animatable) {
|
||||
if (imageInfo != null) {
|
||||
mEventDispatcher.dispatchEvent(
|
||||
new ImageLoadEvent(getId(), SystemClock.nanoTime(), ImageLoadEvent.ON_LOAD_END)
|
||||
new ImageLoadEvent(getId(), SystemClock.nanoTime(), ImageLoadEvent.ON_LOAD)
|
||||
);
|
||||
mEventDispatcher.dispatchEvent(
|
||||
new ImageLoadEvent(getId(), SystemClock.nanoTime(), ImageLoadEvent.ON_LOAD)
|
||||
new ImageLoadEvent(getId(), SystemClock.nanoTime(), ImageLoadEvent.ON_LOAD_END)
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -204,7 +204,10 @@ public class ReactImageView extends GenericDraweeView {
|
||||
@Override
|
||||
public void onFailure(String id, Throwable throwable) {
|
||||
mEventDispatcher.dispatchEvent(
|
||||
new ImageLoadEvent(getId(), SystemClock.nanoTime(), ImageLoadEvent.ON_LOAD_END)
|
||||
new ImageLoadEvent(getId(), SystemClock.nanoTime(), ImageLoadEvent.ON_ERROR)
|
||||
);
|
||||
mEventDispatcher.dispatchEvent(
|
||||
new ImageLoadEvent(getId(), SystemClock.nanoTime(), ImageLoadEvent.ON_LOAD_END)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user