From cd71a71ad14b11c5f366ff75b3252abcd3655f77 Mon Sep 17 00:00:00 2001 From: David Vacca Date: Thu, 25 May 2023 10:29:01 -0700 Subject: [PATCH] Add documentation into DefaultReactHostDelegate (#37561) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37561 Add documentation into DefaultReactHostDelegate changelog: [internal] internal Reviewed By: cortinico Differential Revision: D45717456 fbshipit-source-id: b9485db26fa8a6c0e9a2267915e3269276e8138d --- .../defaults/DefaultBindingsInstaller.kt | 7 ++++++- .../defaults/DefaultReactHostDelegate.kt | 20 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultBindingsInstaller.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultBindingsInstaller.kt index e8eba2256b0..638451231eb 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultBindingsInstaller.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultBindingsInstaller.kt @@ -7,7 +7,12 @@ package com.facebook.react.defaults +import com.facebook.jni.annotations.DoNotStrip import com.facebook.react.bridgeless.BindingsInstaller import com.facebook.react.common.annotations.UnstableReactNativeAPI -@UnstableReactNativeAPI class DefaultBindingsInstaller : BindingsInstaller(null) {} +/** + * A utility class that provides users a default [BindingsInstaller] class that's used to initialize + * [ReactHostDelegate] + */ +@DoNotStrip @UnstableReactNativeAPI class DefaultBindingsInstaller : BindingsInstaller(null) {} diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHostDelegate.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHostDelegate.kt index 1d8290e534a..ba09e91f590 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHostDelegate.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHostDelegate.kt @@ -7,6 +7,7 @@ package com.facebook.react.defaults +import com.facebook.jni.annotations.DoNotStrip import com.facebook.react.ReactPackage import com.facebook.react.bridge.JSBundleLoader import com.facebook.react.bridge.ReactApplicationContext @@ -19,6 +20,25 @@ import com.facebook.react.common.annotations.UnstableReactNativeAPI import com.facebook.react.fabric.ReactNativeConfig import com.facebook.react.turbomodule.core.TurboModuleManagerDelegate +/** + * A utility class that allows you to simplify the initialization of React Native by setting up a + * [ReactHostDelegate] that uses recommended dependencies. + * + * @param jSMainModulePath Path to your app's main module on Metro. This is used when reloading JS + * during development. All paths are relative to the root folder the packager is serving files + * from. Examples: `index.android` or `subdirectory/index.android` + * @param jSBundleLoader Bundle loader to use when setting up JS environment.

Example: + * [JSBundleLoader.createFileLoader(application, bundleFile)] + * @param reactPackages list of reactPackages to expose Native Modules and View Components to JS + * @param jSEngineInstance Object that holds a native reference to the javascript engine + * @param bindingsInstaller Object that holds a native C++ references that allow host applications + * to install C++ objects into jsi::Runtime during the initialization of React Native + * @param reactNativeConfig ReactNative Configuration that allows to customize the behavior of + * key/value pairs used by the framework to enable/disable experimental capabilities + * @param exceptionHandler Callback that can be used by React Native host applications to react to + * exceptions thrown by the internals of React Native. + */ +@DoNotStrip @UnstableReactNativeAPI class DefaultReactHostDelegate( override val jSMainModulePath: String,