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
This commit is contained in:
David Vacca
2019-11-15 09:30:41 -08:00
committed by Facebook Github Bot
parent 9713b63d9a
commit cddf9eb1da
@@ -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;
}
}