From d5d55bf081de9315ffcfe929db840a22f185c799 Mon Sep 17 00:00:00 2001 From: Arushi Kesarwani Date: Mon, 18 Mar 2024 23:00:30 -0700 Subject: [PATCH] Support reload in ReactDelegate (#43521) Summary: Changelog: [Android] [Added] - Support reload() in ReactDelegate Differential Revision: D54967602 --- packages/react-native/ReactAndroid/api/ReactAndroid.api | 1 + .../src/main/java/com/facebook/react/ReactDelegate.java | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/packages/react-native/ReactAndroid/api/ReactAndroid.api b/packages/react-native/ReactAndroid/api/ReactAndroid.api index 173b7b75813eec..9c3626694e48cc 100644 --- a/packages/react-native/ReactAndroid/api/ReactAndroid.api +++ b/packages/react-native/ReactAndroid/api/ReactAndroid.api @@ -158,6 +158,7 @@ public class com/facebook/react/ReactDelegate { public fun onKeyLongPress (I)Z public fun onNewIntent (Landroid/content/Intent;)Z public fun onWindowFocusChanged (Z)V + public fun reload ()V public fun shouldShowDevMenuOrReload (ILandroid/view/KeyEvent;)Z } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java index 9650a57c9aeb88..16fdf3efda5866 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java @@ -225,6 +225,13 @@ public boolean onKeyLongPress(int keyCode) { return false; } + public void reload() { + DevSupportManager devSupportManager = getDevSupportManager(); + if (devSupportManager != null) { + devSupportManager.handleReloadJS(); + } + } + public void loadApp() { loadApp(mMainComponentName); }