Provide getters for CallerContext and DraweeControllerBuilder in ReactViewManager

Summary: public Right now there is no centralized place to initialize CallerContext for Fresco. It should probably go through FrescoModule, but currently it's going through ReactImageManager, and thus unavailable to FlatUIImplementation, that doesn't use ReactImageManager. So this diff provides public getters for CallerContext (and DraweeControllerBuilder) in ReactViewManager. This is hacky and generally should not be needed, but without it groups don't have correct CallerContext set.

Reviewed By: kmagiera, astreet

Differential Revision: D2569372

fb-gh-sync-id: 2622e69c64bfebfc575deb330ee77e0139efb7ec
This commit is contained in:
Denis Koroskin 2015-11-30 12:31:43 -08:00 committed by facebook-github-bot-0
parent bb62d0b5d6
commit dd5bb96e44
1 changed files with 11 additions and 4 deletions

View File

@ -48,16 +48,23 @@ public class ReactImageManager extends SimpleViewManager<ReactImageView> {
mCallerContext = null; mCallerContext = null;
} }
@Override public AbstractDraweeControllerBuilder getDraweeControllerBuilder() {
public ReactImageView createViewInstance(ThemedReactContext context) {
if (mDraweeControllerBuilder == null) { if (mDraweeControllerBuilder == null) {
mDraweeControllerBuilder = Fresco.newDraweeControllerBuilder(); mDraweeControllerBuilder = Fresco.newDraweeControllerBuilder();
} }
return mDraweeControllerBuilder;
}
public Object getCallerContext() {
return mCallerContext;
}
@Override
public ReactImageView createViewInstance(ThemedReactContext context) {
return new ReactImageView( return new ReactImageView(
context, context,
mDraweeControllerBuilder, getDraweeControllerBuilder(),
mCallerContext); getCallerContext());
} }
// In JS this is Image.props.source.uri // In JS this is Image.props.source.uri