Add a field + getter for instanceKey to ReactContext

Summary:
Adding a new String field for `instanceKey` to ReactContext, which is set via a new constructor on ReactApplicationContext. Also adding getters to ReactContext and ThemedReactContext so that it's accessible from any instance/subclass of ReactContext.

This will only be used in bridgeless mode.

Reviewed By: mdvacca

Differential Revision: D18316556

fbshipit-source-id: 9757da72fde4ba36034c1e129326461fed496229
This commit is contained in:
Emily Janzer
2019-11-05 19:01:53 -08:00
committed by Facebook Github Bot
parent f77abc583c
commit 6598292ede
3 changed files with 38 additions and 0 deletions
@@ -20,4 +20,15 @@ public class ReactApplicationContext extends ReactContext {
public ReactApplicationContext(Context context) {
super(context.getApplicationContext());
}
/**
* A constructor that takes a unique string identifier for the React instance. For bridgeless mode
* only - do not use.
*
* <p>TODO T43898341 Make this package-private once we've consolidated the classes that need this
* in this package
*/
public ReactApplicationContext(Context context, String instanceKey) {
super(context.getApplicationContext(), instanceKey);
}
}