mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-02 23:05:01 +08:00
Begin inverting dependency between new+old bridge
Reviewed By: mhorowitz Differential Revision: D3306510 fbshipit-source-id: 312a498a4461e980f1f749fe7858a13be14dfa2f
This commit is contained in:
committed by
Facebook Github Bot 0
parent
26a5b033f8
commit
5b871ad9d7
@@ -14,56 +14,9 @@ import com.facebook.react.uimanager.UIImplementationProvider;
|
||||
|
||||
public abstract class XReactInstanceManager {
|
||||
/**
|
||||
* Creates a builder that is capable of creating an instance of {@link XReactInstanceManagerImpl}.
|
||||
* Creates a builder that is defaulted to using the new bridge.
|
||||
*/
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builder class for {@link XReactInstanceManagerImpl}
|
||||
*/
|
||||
public static class Builder extends ReactInstanceManager.Builder {
|
||||
/**
|
||||
* Instantiates a new {@link ReactInstanceManagerImpl}.
|
||||
* Before calling {@code build}, the following must be called:
|
||||
* <ul>
|
||||
* <li> {@link #setApplication}
|
||||
* <li> {@link #setCurrentActivity} if the activity has already resumed
|
||||
* <li> {@link #setDefaultHardwareBackBtnHandler} if the activity has already resumed
|
||||
* <li> {@link #setJSBundleFile} or {@link #setJSMainModuleName}
|
||||
* </ul>
|
||||
*/
|
||||
public ReactInstanceManager build() {
|
||||
Assertions.assertCondition(
|
||||
mUseDeveloperSupport || mJSBundleFile != null,
|
||||
"JS Bundle File has to be provided when dev support is disabled");
|
||||
|
||||
Assertions.assertCondition(
|
||||
mJSMainModuleName != null || mJSBundleFile != null,
|
||||
"Either MainModuleName or JS Bundle File needs to be provided");
|
||||
|
||||
if (mUIImplementationProvider == null) {
|
||||
// create default UIImplementationProvider if the provided one is null.
|
||||
mUIImplementationProvider = new UIImplementationProvider();
|
||||
}
|
||||
|
||||
return new XReactInstanceManagerImpl(
|
||||
Assertions.assertNotNull(
|
||||
mApplication,
|
||||
"Application property has not been set with this builder"),
|
||||
mCurrentActivity,
|
||||
mDefaultHardwareBackBtnHandler,
|
||||
mJSBundleFile,
|
||||
mJSMainModuleName,
|
||||
mPackages,
|
||||
mUseDeveloperSupport,
|
||||
mBridgeIdleDebugListener,
|
||||
Assertions.assertNotNull(mInitialLifecycleState, "Initial lifecycle state was not set"),
|
||||
mUIImplementationProvider,
|
||||
mNativeModuleCallExceptionHandler,
|
||||
mJSCConfig,
|
||||
mRedBoxHandler);
|
||||
}
|
||||
public static ReactInstanceManager.Builder builder() {
|
||||
return new ReactInstanceManager.Builder().setUseNewBridge();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user