From cddf9eb1da7a326160c436b8a9d1377eb8d5b7f6 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Fri, 15 Nov 2019 09:28:22 -0800 Subject: [PATCH] Extending ThemeReactContext to store surfaceID Summary: This diff extends ThemeReactContext class to store the surfaceID field The getSurfaceID method is being exposed as a public method Changelog: [internal] Reviewed By: JoshuaGross Differential Revision: D18474015 fbshipit-source-id: ee1f859a802d36c51dec537fa91d90022523e88d --- .../react/uimanager/ThemedReactContext.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.java index 91d6cdc59be..e956822eefc 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.java +++ b/ReactAndroid/src/main/java/com/facebook/react/uimanager/ThemedReactContext.java @@ -25,13 +25,20 @@ import com.facebook.react.bridge.ReactContext; public class ThemedReactContext extends ReactContext { private final ReactApplicationContext mReactApplicationContext; + @Nullable private final String mSurfaceID; public ThemedReactContext(ReactApplicationContext reactApplicationContext, Context base) { + this(reactApplicationContext, base, null); + } + + public ThemedReactContext( + ReactApplicationContext reactApplicationContext, Context base, @Nullable String surfaceID) { super(base); if (reactApplicationContext.hasCatalystInstance()) { initializeWithInstance(reactApplicationContext.getCatalystInstance()); } mReactApplicationContext = reactApplicationContext; + mSurfaceID = surfaceID; } @Override @@ -59,4 +66,12 @@ public class ThemedReactContext extends ReactContext { public String getInstanceKey() { return mReactApplicationContext.getInstanceKey(); } + + /** + * @return a {@link String} that represents the ID of the js application that is being rendered + * with this {@link ThemedReactContext} + */ + public @Nullable String getSurfaceID() { + return mSurfaceID; + } }