diff --git a/ReactAndroid/src/main/java/com/facebook/react/JSCConfig.java b/ReactAndroid/src/main/java/com/facebook/react/JSCConfig.java index 959a6f8d3..b541cfb01 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/JSCConfig.java +++ b/ReactAndroid/src/main/java/com/facebook/react/JSCConfig.java @@ -8,5 +8,12 @@ import com.facebook.react.bridge.WritableNativeMap; * Interface for the configuration object that is passed to JSC. */ public interface JSCConfig { - public WritableNativeMap getConfigMap(); + JSCConfig EMPTY = new JSCConfig() { + @Override + public WritableNativeMap getConfigMap() { + return new WritableNativeMap(); + } + }; + + WritableNativeMap getConfigMap(); } diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java b/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java index 519940241..ccfd3fa14 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java @@ -191,7 +191,7 @@ public abstract class ReactInstanceManager { protected @Nullable LifecycleState mInitialLifecycleState; protected @Nullable UIImplementationProvider mUIImplementationProvider; protected @Nullable NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler; - protected @Nullable JSCConfig mJSCConfig; + protected JSCConfig mJSCConfig = JSCConfig.EMPTY; protected @Nullable Activity mCurrentActivity; protected @Nullable DefaultHardwareBackBtnHandler mDefaultHardwareBackBtnHandler; protected @Nullable RedBoxHandler mRedBoxHandler; diff --git a/ReactAndroid/src/main/java/com/facebook/react/XReactInstanceManagerImpl.java b/ReactAndroid/src/main/java/com/facebook/react/XReactInstanceManagerImpl.java index 410a3c59f..7eb599cc3 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/XReactInstanceManagerImpl.java +++ b/ReactAndroid/src/main/java/com/facebook/react/XReactInstanceManagerImpl.java @@ -125,7 +125,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE; private final UIImplementationProvider mUIImplementationProvider; private final MemoryPressureRouter mMemoryPressureRouter; private final @Nullable NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler; - private final @Nullable JSCConfig mJSCConfig; + private final JSCConfig mJSCConfig; private @Nullable RedBoxHandler mRedBoxHandler; private final ReactInstanceDevCommandsHandler mDevInterface = @@ -283,7 +283,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE; LifecycleState initialLifecycleState, UIImplementationProvider uiImplementationProvider, NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler, - @Nullable JSCConfig jscConfig) { + JSCConfig jscConfig) { this(applicationContext, currentActivity, @@ -312,7 +312,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE; LifecycleState initialLifecycleState, UIImplementationProvider uiImplementationProvider, NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler, - @Nullable JSCConfig jscConfig, + JSCConfig jscConfig, @Nullable RedBoxHandler redBoxHandler) { initializeSoLoaderIfNecessary(applicationContext); @@ -443,8 +443,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE; private void recreateReactContextInBackgroundFromBundleFile() { recreateReactContextInBackground( - new JSCJavaScriptExecutor.Factory( - mJSCConfig == null ? new WritableNativeMap() : mJSCConfig.getConfigMap()), + new JSCJavaScriptExecutor.Factory(mJSCConfig.getConfigMap()), JSBundleLoader.createFileLoader(mApplicationContext, mJSBundleFile)); } @@ -721,8 +720,7 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE; private void onJSBundleLoadedFromServer() { recreateReactContextInBackground( - new JSCJavaScriptExecutor.Factory( - mJSCConfig == null ? new WritableNativeMap() : mJSCConfig.getConfigMap()), + new JSCJavaScriptExecutor.Factory(mJSCConfig.getConfigMap()), JSBundleLoader.createCachedBundleFromNetworkLoader( mDevSupportManager.getSourceUrl(), mDevSupportManager.getDownloadedJSBundleFile()));