diff --git a/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.java b/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.java index 19ff94205..8803652d1 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageManager.java @@ -32,7 +32,7 @@ public class ReactImageManager extends SimpleViewManager { return REACT_CLASS; } - private final @Nullable AbstractDraweeControllerBuilder mDraweeControllerBuilder; + private @Nullable AbstractDraweeControllerBuilder mDraweeControllerBuilder; private final @Nullable Object mCallerContext; public ReactImageManager( @@ -43,16 +43,20 @@ public class ReactImageManager extends SimpleViewManager { } public ReactImageManager() { + // Lazily initialize as FrescoModule have not been initialized yet mDraweeControllerBuilder = null; mCallerContext = null; } @Override public ReactImageView createViewInstance(ThemedReactContext context) { + if (mDraweeControllerBuilder == null) { + mDraweeControllerBuilder = Fresco.newDraweeControllerBuilder(); + } + return new ReactImageView( context, - mDraweeControllerBuilder == null ? - Fresco.newDraweeControllerBuilder() : mDraweeControllerBuilder, + mDraweeControllerBuilder, mCallerContext); }