From 1ce27bcde572fb1a2f5c5d0221f5007d0b9d7d36 Mon Sep 17 00:00:00 2001 From: Arushi Kesarwani Date: Sat, 16 Mar 2024 00:02:30 -0700 Subject: [PATCH] Support reload in ReactDelegate 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); }