mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Refactor ReactCallerContextFactory to recive surfaceID as a parameter
Summary: This diff refactors the ReactCallerContextFactory class to recive surfaceID as a parameter instead of ThemedReactContext This is necessary for the next diff of the stack changelog: [Internal][Android] Reviewed By: fkgozali Differential Revision: D21362265 fbshipit-source-id: d0079788049fe86d2873eb6aa4bf1115b33457af
This commit is contained in:
committed by
Facebook GitHub Bot
parent
bf0539fb51
commit
8c45255fa5
+5
-3
@@ -1,3 +1,5 @@
|
||||
// (c) Facebook, Inc. and its affiliates. Confidential and proprietary.
|
||||
|
||||
/*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
@@ -8,7 +10,6 @@
|
||||
package com.facebook.react.views.image;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import com.facebook.react.uimanager.ThemedReactContext;
|
||||
|
||||
/**
|
||||
* This interface is used from {@link ReactImageManager} to customize the CallerContext object
|
||||
@@ -19,8 +20,9 @@ public interface ReactCallerContextFactory {
|
||||
/**
|
||||
* This method will be called at the time {@link ReactImageManager} creates {@link ReactImageView}
|
||||
*
|
||||
* @param reactContext {@link ThemedReactContext} used to create the {@link ReactImageView}
|
||||
* @param surfaceID {@link String} used to log the name of the surface
|
||||
* @return an {@link Object} that represents the CallerContext.
|
||||
*/
|
||||
Object getOrCreateCallerContext(ThemedReactContext reactContext, @Nullable String analyticTag);
|
||||
@Nullable
|
||||
Object getOrCreateCallerContext(@Nullable String surfaceID, @Nullable String analyticTag);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class ReactImageManager extends SimpleViewManager<ReactImageView> {
|
||||
public ReactImageView createViewInstance(ThemedReactContext context) {
|
||||
Object callerContext =
|
||||
mCallerContextFactory != null
|
||||
? mCallerContextFactory.getOrCreateCallerContext(context, null)
|
||||
? mCallerContextFactory.getOrCreateCallerContext(context.getSurfaceID(), null)
|
||||
: getCallerContext();
|
||||
return new ReactImageView(
|
||||
context, getDraweeControllerBuilder(), mGlobalImageLoadListener, callerContext);
|
||||
@@ -129,7 +129,7 @@ public class ReactImageManager extends SimpleViewManager<ReactImageView> {
|
||||
if (mCallerContextFactory != null) {
|
||||
view.updateCallerContext(
|
||||
mCallerContextFactory.getOrCreateCallerContext(
|
||||
(ThemedReactContext) view.getContext(), analyticTag));
|
||||
((ThemedReactContext) view.getContext()).getSurfaceID(), analyticTag));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user