diff --git a/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java b/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java index b302024426b..bdbc217b914 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java +++ b/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java @@ -16,6 +16,8 @@ import java.util.List; import android.app.Application; import com.facebook.infer.annotation.Assertions; +import com.facebook.react.devsupport.RedBoxHandler; +import com.facebook.react.uimanager.UIImplementationProvider; /** * Simple class that holds an instance of {@link ReactInstanceManager}. This can be used in your @@ -64,6 +66,8 @@ public abstract class ReactNativeHost { .setApplication(mApplication) .setJSMainModuleName(getJSMainModuleName()) .setUseDeveloperSupport(getUseDeveloperSupport()) + .setRedBoxHandler(getRedBoxHandler()) + .setUIImplementationProvider(getUIImplementationProvider()) .setInitialLifecycleState(LifecycleState.BEFORE_CREATE); for (ReactPackage reactPackage : getPackages()) { @@ -76,10 +80,26 @@ public abstract class ReactNativeHost { } else { builder.setBundleAssetName(Assertions.assertNotNull(getBundleAssetName())); } - return builder.build(); } + /** + * Get the {@link RedBoxHandler} to send RedBox-related callbacks to. + */ + protected @Nullable RedBoxHandler getRedBoxHandler() { + return null; + } + + /** + * Get the {@link UIImplementationProvider} to use. Override this method if you want to use a + * custom UI implementation. + * + * Note: this is very advanced functionality, in 99% of cases you don't need to override this. + */ + protected UIImplementationProvider getUIImplementationProvider() { + return new UIImplementationProvider(); + } + /** * Returns the name of the main module. Determines the URL used to fetch the JS bundle * from the packager server. It is only used when dev support is enabled.