Add support for ImageLoadEvents to RCTImageView

Summary: This diff implements ImageLoadEvents (ON_LOAD, ON_LOAD_END and ON_LOAD_START) in RCTImageView. ON_ERROR and ON_PROGRESS are easy to implement, too, but these 2 are supposed to carry extra information (error message and progress) but ImageLoadEvent doesn't support a payload yet (I'll add them in a separate patch).

Reviewed By: ahmedre

Differential Revision: D2824772
This commit is contained in:
Denis Koroskin
2016-01-12 18:51:12 -08:00
committed by Ahmed El-Helw
parent 76abec8894
commit 59fe71caff
9 changed files with 115 additions and 7 deletions

View File

@@ -14,6 +14,7 @@ import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import com.facebook.drawee.controller.AbstractDraweeControllerBuilder;
import com.facebook.drawee.controller.ControllerListener;
import com.facebook.drawee.generic.GenericDraweeHierarchy;
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
import com.facebook.drawee.interfaces.DraweeController;
@@ -37,10 +38,11 @@ import com.facebook.infer.annotation.Assertions;
private final DraweeController mDraweeController;
private int mAttachCounter;
/* package */ DraweeRequestHelper(ImageRequest imageRequest) {
/* package */ DraweeRequestHelper(ImageRequest imageRequest, ControllerListener listener) {
DraweeController controller = sControllerBuilder
.setImageRequest(imageRequest)
.setCallerContext(RCTImageView.getCallerContext())
.setControllerListener(listener)
.build();
controller.setHierarchy(sHierarchyBuilder.build());