Allow creating ThemedReactContext without CatalystInstance

Summary: I'm not sure if this is a good idea. Right now FabricUIManager creates a ThemedReactContext in addRootView() using the RAC you pass in. If you pass in an RAC without a Catalyst instance, this will throw; this diff makes it so it'll throw the next time you try to actually try to access the CatalystInstance, instead. I don't know if we're really relying on this right now, but we need to be able to create a ThemedReactContext without a CatalystInstance for Venice (for now, until we actually go through and get rid of TRC's dependency on the CatalystInstance entirely - but that'll be a lot more work)

Reviewed By: mdvacca

Differential Revision: D15194220

fbshipit-source-id: 64689cbe79c84ae33fe16e3dc396e3c69ec8e20f
This commit is contained in:
Emily Janzer
2019-05-06 15:41:17 -07:00
committed by Facebook Github Bot
parent c6b4eb7dcf
commit 6cf784fae7

View File

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