android: add ReactInstancePackage abstract class to pass down ReactInstanceManager to create modules

Summary:
At times, ReactPackage needs to get information from the ReactInstanceManager, e.g. to get the DevSupportManager for debugging purpose. This allows passing down the instance manager to create the native modules, in addition to just ReactApplicationContext. It is then up to the Package to use it or not.

To use this, you must make your package class extends ReactInstancePackage, instead of just implementing ReactPackage interface.

Reviewed By: mmmulani

Differential Revision: D4641997

fbshipit-source-id: 497c4408a7d2b773c49f08bff7c1bf8f9d372edb
This commit is contained in:
Kevin Gozali
2017-03-06 15:15:15 -08:00
committed by Facebook Github Bot
parent 4c79df9970
commit 7acf74122d
5 changed files with 76 additions and 3 deletions

View File

@@ -37,7 +37,7 @@ public class ReactTestHelper {
private static class ReactInstanceEasyBuilderImpl implements ReactInstanceEasyBuilder {
private final NativeModuleRegistryBuilder mNativeModuleRegistryBuilder =
new NativeModuleRegistryBuilder(null, false);
new NativeModuleRegistryBuilder(null, null, false);
private final JavaScriptModuleRegistry.Builder mJSModuleRegistryBuilder =
new JavaScriptModuleRegistry.Builder();