Allow creating ThemedReactContext without a CatalystInstance

Summary: In the future we're planning to decouple ThemedReactContext from the bridge (CatalystInstance). For now, we just need to be able to create a ThemedReactContext with a ReactContext that has no Catalyst instance.

Reviewed By: mdvacca

Differential Revision: D15246442

fbshipit-source-id: 99ebda6521f4df72969011ea0e6ea41b046875c8
This commit is contained in:
Emily Janzer
2019-05-09 17:43:55 -07:00
committed by Facebook Github Bot
parent 5f9bb72bb3
commit d5b27fc0a8
2 changed files with 7 additions and 1 deletions

View File

@@ -147,6 +147,10 @@ public class ReactContext extends ContextWrapper {
return mCatalystInstance != null && !mCatalystInstance.isDestroyed();
}
public boolean hasCatalystInstance() {
return mCatalystInstance != null;
}
public LifecycleState getLifecycleState() {
return mLifecycleState;
}

View File

@@ -30,7 +30,9 @@ public class ThemedReactContext extends ReactContext {
public ThemedReactContext(ReactApplicationContext reactApplicationContext, Context base) {
super(base);
initializeWithInstance(reactApplicationContext.getCatalystInstance());
if (reactApplicationContext.hasCatalystInstance()) {
initializeWithInstance(reactApplicationContext.getCatalystInstance());
}
mReactApplicationContext = reactApplicationContext;
}