mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 22:50:10 +08:00
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:
committed by
Facebook Github Bot
parent
5f9bb72bb3
commit
d5b27fc0a8
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user