mirror of
https://github.com/status-im/react-native.git
synced 2025-02-10 08:26:23 +00:00
Passing current activity while creating react instance manager
Reviewed By: astreet Differential Revision: D3236602 fb-gh-sync-id: efbac8f0d8c770f2edf6fb447498e650302d98c7 fbshipit-source-id: efbac8f0d8c770f2edf6fb447498e650302d98c7
This commit is contained in:
parent
90f9f48498
commit
edf5d85be0
@ -186,6 +186,8 @@ public abstract class ReactInstanceManager {
|
|||||||
protected @Nullable UIImplementationProvider mUIImplementationProvider;
|
protected @Nullable UIImplementationProvider mUIImplementationProvider;
|
||||||
protected @Nullable NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler;
|
protected @Nullable NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler;
|
||||||
protected @Nullable JSCConfig mJSCConfig;
|
protected @Nullable JSCConfig mJSCConfig;
|
||||||
|
protected @Nullable Activity mCurrentActivity;
|
||||||
|
protected @Nullable DefaultHardwareBackBtnHandler mDefaultHardwareBackBtnHandler;
|
||||||
|
|
||||||
protected Builder() {
|
protected Builder() {
|
||||||
}
|
}
|
||||||
@ -250,6 +252,17 @@ public abstract class ReactInstanceManager {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder setCurrentActivity(Activity activity) {
|
||||||
|
mCurrentActivity = activity;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setDefaultHardwareBackBtnHandler(
|
||||||
|
DefaultHardwareBackBtnHandler defaultHardwareBackBtnHandler) {
|
||||||
|
mDefaultHardwareBackBtnHandler = defaultHardwareBackBtnHandler;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When {@code true}, developer options such as JS reloading and debugging are enabled.
|
* When {@code true}, developer options such as JS reloading and debugging are enabled.
|
||||||
* Note you still have to call {@link #showDevOptionsDialog} to show the dev menu,
|
* Note you still have to call {@link #showDevOptionsDialog} to show the dev menu,
|
||||||
@ -289,6 +302,8 @@ public abstract class ReactInstanceManager {
|
|||||||
* Before calling {@code build}, the following must be called:
|
* Before calling {@code build}, the following must be called:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li> {@link #setApplication}
|
* <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}
|
* <li> {@link #setJSBundleFile} or {@link #setJSMainModuleName}
|
||||||
* </ul>
|
* </ul>
|
||||||
*/
|
*/
|
||||||
@ -310,6 +325,8 @@ public abstract class ReactInstanceManager {
|
|||||||
Assertions.assertNotNull(
|
Assertions.assertNotNull(
|
||||||
mApplication,
|
mApplication,
|
||||||
"Application property has not been set with this builder"),
|
"Application property has not been set with this builder"),
|
||||||
|
mCurrentActivity,
|
||||||
|
mDefaultHardwareBackBtnHandler,
|
||||||
mJSBundleFile,
|
mJSBundleFile,
|
||||||
mJSMainModuleName,
|
mJSMainModuleName,
|
||||||
mPackages,
|
mPackages,
|
||||||
|
@ -268,6 +268,8 @@ import static com.facebook.react.bridge.ReactMarkerConstants.RUN_JS_BUNDLE_START
|
|||||||
|
|
||||||
/* package */ ReactInstanceManagerImpl(
|
/* package */ ReactInstanceManagerImpl(
|
||||||
Context applicationContext,
|
Context applicationContext,
|
||||||
|
@Nullable Activity currentActivity,
|
||||||
|
@Nullable DefaultHardwareBackBtnHandler defaultHardwareBackBtnHandler,
|
||||||
@Nullable String jsBundleFile,
|
@Nullable String jsBundleFile,
|
||||||
@Nullable String jsMainModuleName,
|
@Nullable String jsMainModuleName,
|
||||||
List<ReactPackage> packages,
|
List<ReactPackage> packages,
|
||||||
@ -284,6 +286,8 @@ import static com.facebook.react.bridge.ReactMarkerConstants.RUN_JS_BUNDLE_START
|
|||||||
setDisplayMetrics(applicationContext);
|
setDisplayMetrics(applicationContext);
|
||||||
|
|
||||||
mApplicationContext = applicationContext;
|
mApplicationContext = applicationContext;
|
||||||
|
mCurrentActivity = currentActivity;
|
||||||
|
mDefaultBackButtonImpl = defaultHardwareBackBtnHandler;
|
||||||
mJSBundleFile = jsBundleFile;
|
mJSBundleFile = jsBundleFile;
|
||||||
mJSMainModuleName = jsMainModuleName;
|
mJSMainModuleName = jsMainModuleName;
|
||||||
mPackages = packages;
|
mPackages = packages;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user