Skip to content

Commit a302fbc

Browse files
Maddie Lordfacebook-github-bot
authored andcommitted
Set ReactSurface and ReactRootView to ReactDelegate when created via ReactNavigationActivityDelegate (#49580)
Summary: Pull Request resolved: #49580 Add setReactSurface and setReactRootView methods for custom delegates. Reviewed By: arushikesarwani94 Differential Revision: D69925812 fbshipit-source-id: b2acd3e541bd34216d9f8cadbdf2fa5c04e46b98
1 parent f17c264 commit a302fbc

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ public class com/facebook/react/ReactActivityDelegate {
140140
public fun onUserLeaveHint ()V
141141
public fun onWindowFocusChanged (Z)V
142142
public fun requestPermissions ([Ljava/lang/String;ILcom/facebook/react/modules/core/PermissionListener;)V
143+
public fun setReactRootView (Lcom/facebook/react/ReactRootView;)V
144+
public fun setReactSurface (Lcom/facebook/react/interfaces/fabric/ReactSurface;)V
143145
}
144146

145147
public abstract interface class com/facebook/react/ReactApplication {
@@ -171,6 +173,8 @@ public class com/facebook/react/ReactDelegate {
171173
public fun onUserLeaveHint ()V
172174
public fun onWindowFocusChanged (Z)V
173175
public fun reload ()V
176+
public fun setReactRootView (Lcom/facebook/react/ReactRootView;)V
177+
public fun setReactSurface (Lcom/facebook/react/interfaces/fabric/ReactSurface;)V
174178
public fun shouldShowDevMenuOrReload (ILandroid/view/KeyEvent;)Z
175179
public fun unloadApp ()V
176180
}

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.facebook.react.bridge.Callback;
2121
import com.facebook.react.bridge.ReactContext;
2222
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture;
23+
import com.facebook.react.interfaces.fabric.ReactSurface;
2324
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
2425
import com.facebook.react.modules.core.PermissionListener;
2526
import com.facebook.systrace.Systrace;
@@ -156,6 +157,14 @@ protected void loadApp(String appKey) {
156157
getPlainActivity().setContentView(mReactDelegate.getReactRootView());
157158
}
158159

160+
public void setReactSurface(ReactSurface reactSurface) {
161+
mReactDelegate.setReactSurface(reactSurface);
162+
}
163+
164+
public void setReactRootView(ReactRootView reactRootView) {
165+
mReactDelegate.setReactRootView(reactRootView);
166+
}
167+
159168
public void onUserLeaveHint() {
160169
if (mReactDelegate != null) {
161170
mReactDelegate.onUserLeaveHint();

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,14 @@ public void unloadApp() {
318318
}
319319
}
320320

321+
public void setReactSurface(ReactSurface reactSurface) {
322+
mReactSurface = reactSurface;
323+
}
324+
325+
public void setReactRootView(ReactRootView reactRootView) {
326+
mReactRootView = reactRootView;
327+
}
328+
321329
@Nullable
322330
public ReactRootView getReactRootView() {
323331
if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) {

0 commit comments

Comments
 (0)