Skip to content

Commit

Permalink
Move ReactHost.destroy to ReactHostInterface (facebook#38697)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#38697

Move ReactHost.destroy to ReactHostInterface

changelog: [internal] internal

Reviewed By: rshest

Differential Revision: D47915485

fbshipit-source-id: 491af8fa76cb6eb738acc9a87922ac8099e7547e
  • Loading branch information
mdvacca authored and facebook-github-bot committed Aug 1, 2023
1 parent 4e44fda commit 30a312c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ public TaskInterface<Void> reload(String reason) {
* This exception will be used to log properly the cause of destroy operation.
* @return A task that completes when React Native gets destroyed.
*/
public Task<Void> destroy(String reason, @Nullable Exception ex) {
@Override
public TaskInterface<Void> destroy(String reason, @Nullable Exception ex) {
final String method = "destroy()";
if (ReactFeatureFlags.enableBridgelessArchitectureNewCreateReloadDestroy) {
return Task.call(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,15 @@ interface ReactHostInterface {
* @return A task that completes when React Native reloads
*/
fun reload(reason: String): TaskInterface<Void>

/**
* Entrypoint to destroy the ReactInstance. If the ReactInstance is reloading, will wait until
* reload is finished, before destroying.
*
* @param reason [String] describing why ReactHost is being destroyed (e.g. memmory pressure)
* @param ex [Exception] exception that caused the trigger to destroy ReactHost (or null) This
* exception will be used to log properly the cause of destroy operation.
* @return A task that completes when React Native gets destroyed.
*/
fun destroy(reason: String, ex: Exception?): TaskInterface<Void>
}

0 comments on commit 30a312c

Please sign in to comment.