mirror of
https://github.com/status-im/react-native.git
synced 2025-01-27 01:40:08 +00:00
Reuse DraweeControllerBuilder instead of allocating one for every image
Reviewed By: astreet Differential Revision: D2699801 fb-gh-sync-id: 883e788f0a5c7231bf26f1ba4149115a15487366
This commit is contained in:
parent
699a75b01f
commit
2c0679bed1
@ -32,7 +32,7 @@ public class ReactImageManager extends SimpleViewManager<ReactImageView> {
|
||||
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<ReactImageView> {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user