mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Expose ReactDelegate for react-native-restart (#43588)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/43588 Supported `reload()` in Bridgeless through ReactDelegate in https://github.com/facebook/react-native/pull/43521 in order to unblock react-native-restart https://github.com/avishayil/react-native-restart/blob/134cabd5b3f355ffe551e5dd1be1dd46d870fe13/android/src/main/java/com/reactnativerestart/RestartModule.java#L54 which can access React Delegate through : ``` if(currentActivity instanceof ReactActivity) { ReactActivity reactActivity = (ReactActivity) currentActivity; ReactDelegate reactDelegate = reactActivity.getReactDelegate(); reactDelegate.reload() } ``` Changelog: [Android][Added] Expose ReactDelegate in ReactActivity Reviewed By: cortinico Differential Revision: D55166962 fbshipit-source-id: 5d8dfd7ad61edbcb5233014800eb66a538842ca5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c574ca59dc
commit
62ebe557b8
@@ -83,6 +83,7 @@ public abstract class com/facebook/react/ReactActivity : androidx/appcompat/app/
|
||||
protected fun <init> ()V
|
||||
protected fun createReactActivityDelegate ()Lcom/facebook/react/ReactActivityDelegate;
|
||||
protected fun getMainComponentName ()Ljava/lang/String;
|
||||
public fun getReactDelegate ()V
|
||||
protected final fun getReactInstanceManager ()Lcom/facebook/react/ReactInstanceManager;
|
||||
protected final fun getReactNativeHost ()Lcom/facebook/react/ReactNativeHost;
|
||||
public fun invokeDefaultOnBackPressed ()V
|
||||
@@ -113,6 +114,7 @@ public class com/facebook/react/ReactActivityDelegate {
|
||||
protected fun getLaunchOptions ()Landroid/os/Bundle;
|
||||
public fun getMainComponentName ()Ljava/lang/String;
|
||||
protected fun getPlainActivity ()Landroid/app/Activity;
|
||||
protected fun getReactDelegate ()Lcom/facebook/react/ReactDelegate;
|
||||
public fun getReactHost ()Lcom/facebook/react/ReactHost;
|
||||
public fun getReactInstanceManager ()Lcom/facebook/react/ReactInstanceManager;
|
||||
protected fun getReactNativeHost ()Lcom/facebook/react/ReactNativeHost;
|
||||
|
||||
@@ -65,6 +65,10 @@ public abstract class ReactActivity extends AppCompatActivity
|
||||
mDelegate.onDestroy();
|
||||
}
|
||||
|
||||
public void getReactDelegate() {
|
||||
mDelegate.getReactDelegate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
+4
@@ -87,6 +87,10 @@ public class ReactActivityDelegate {
|
||||
return ((ReactApplication) getPlainActivity().getApplication()).getReactHost();
|
||||
}
|
||||
|
||||
protected @Nullable ReactDelegate getReactDelegate() {
|
||||
return mReactDelegate;
|
||||
}
|
||||
|
||||
public ReactInstanceManager getReactInstanceManager() {
|
||||
return mReactDelegate.getReactInstanceManager();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user