mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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:
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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user