diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageLoadEvent.java b/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageLoadEvent.java index fc183507a..2e19ca089 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageLoadEvent.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/image/ImageLoadEvent.java @@ -9,8 +9,12 @@ package com.facebook.react.views.image; +import javax.annotation.Nullable; + import android.support.annotation.IntDef; +import com.facebook.react.bridge.Arguments; +import com.facebook.react.bridge.WritableMap; import com.facebook.react.uimanager.events.Event; import com.facebook.react.uimanager.events.RCTEventEmitter; @@ -31,10 +35,20 @@ public class ImageLoadEvent extends Event { public static final int ON_PROGRESS = 5; private final int mEventType; + private final @Nullable String mImageUri; public ImageLoadEvent(int viewId, long timestampMs, @ImageEventType int eventType) { + this(viewId, timestampMs, eventType, null); + } + + public ImageLoadEvent( + int viewId, + long timestampMs, + @ImageEventType int eventType, + @Nullable String imageUri) { super(viewId, timestampMs); mEventType = eventType; + mImageUri = imageUri; } public static String eventNameForType(@ImageEventType int eventType) { @@ -68,6 +82,11 @@ public class ImageLoadEvent extends Event { @Override public void dispatch(RCTEventEmitter rctEventEmitter) { - rctEventEmitter.receiveEvent(getViewTag(), getEventName(), null); + WritableMap eventData = null; + if (mImageUri != null) { + eventData = Arguments.createMap(); + eventData.putString("uri", mImageUri); + } + rctEventEmitter.receiveEvent(getViewTag(), getEventName(), eventData); } }