Add reload to ReactHostInterface (#38698)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38698

Add reload to ReactHostInterface

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D47915444

fbshipit-source-id: f423b7daf2f086370c80b3135c2139315e32c9f5
This commit is contained in:
David Vacca
2023-08-01 08:55:40 -07:00
committed by Facebook GitHub Bot
parent 7e44d2cca4
commit 4e44fda261
2 changed files with 13 additions and 2 deletions
@@ -427,7 +427,8 @@ public class ReactHost implements ReactHostInterface {
* tap on reload button)
* @return A task that completes when React Native reloads
*/
public Task<Void> reload(String reason) {
@Override
public TaskInterface<Void> reload(String reason) {
final String method = "reload()";
if (ReactFeatureFlags.enableBridgelessArchitectureNewCreateReloadDestroy) {
return Task.call(
@@ -82,5 +82,15 @@ interface ReactHostInterface {
* errors occur during initialization, and will be cancelled if ReactHost.destroy() is called
* before it completes.
*/
fun start(): TaskInterface<Void?>?
fun start(): TaskInterface<Void>
/**
* Entrypoint to reload the ReactInstance. If the ReactInstance is destroying, will wait until
* destroy is finished, before reloading.
*
* @param reason [String] describing why ReactHost is being reloaded (e.g. js error, user tap on
* reload button)
* @return A task that completes when React Native reloads
*/
fun reload(reason: String): TaskInterface<Void>
}