Support custom DevSupportManager (#31841)

Summary:
to open possibilities for some DX enhancement, the pr introduces `DevSupportManagerFactory` customization. applications could implement a different DevSupportManager in ReactNativeHost.

## Changelog

[Internal] [Added] - Support custom DevSupportManager

Pull Request resolved: https://github.com/facebook/react-native/pull/31841

Test Plan: this pr just introduces some new interfaces and should not break existing functionalities.

Reviewed By: RSNara

Differential Revision: D30878134

Pulled By: yungsters

fbshipit-source-id: ccdf798caa322b07a876da8312b97002da057388
This commit is contained in:
Kudo Chien
2021-09-22 10:33:14 -07:00
committed by Facebook GitHub Bot
parent 88021894f2
commit 369b28ce01
5 changed files with 127 additions and 74 deletions
@@ -219,6 +219,7 @@ public class ReactInstanceManager {
@Nullable String jsMainModulePath,
List<ReactPackage> packages,
boolean useDeveloperSupport,
DevSupportManagerFactory devSupportManagerFactory,
boolean requireActivity,
@Nullable NotThreadSafeBridgeIdleDebugListener bridgeIdleDebugListener,
LifecycleState initialLifecycleState,
@@ -250,7 +251,7 @@ public class ReactInstanceManager {
Systrace.beginSection(
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "ReactInstanceManager.initDevSupportManager");
mDevSupportManager =
DevSupportManagerFactory.create(
devSupportManagerFactory.create(
applicationContext,
createDevHelperInterface(),
mJSMainModulePath,
@@ -1225,7 +1226,8 @@ public class ReactInstanceManager {
// If we can't get a UIManager something has probably gone horribly wrong
if (uiManager == null) {
throw new IllegalStateException(
"Unable to attach a rootView to ReactInstance when UIManager is not properly initialized.");
"Unable to attach a rootView to ReactInstance when UIManager is not properly"
+ " initialized.");
}
@Nullable Bundle initialProperties = reactRoot.getAppProperties();