Skip to content

Commit

Permalink
Fix stack overflow in createRootView (#43420)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #43420

Calling `mReactDelegate.createRootView` just ends up calling the overridden method in the anonymous inner class. Instead have the base implementation return null, and call super.

Changelog: [Internal]

Reviewed By: jessebwr, janeli-100005636499545

Differential Revision: D54772205

fbshipit-source-id: fc90e6718f9c287e8b86e5768cf7f74d0db06c49
  • Loading branch information
javache authored and facebook-github-bot committed Mar 11, 2024
1 parent 3706bf0 commit da21799
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,13 @@ public ReactActivityDelegate(
return getLaunchOptions();
}

/**
* Override to customize ReactRootView creation.
*
* <p>Not used on bridgeless
*/
protected ReactRootView createRootView() {
return Assertions.assertNotNull(mReactDelegate).createRootView();
return null;
}

/**
Expand Down Expand Up @@ -102,7 +107,11 @@ public void onCreate(Bundle savedInstanceState) {
getPlainActivity(), getReactNativeHost(), mainComponentName, launchOptions) {
@Override
protected ReactRootView createRootView() {
return ReactActivityDelegate.this.createRootView();
ReactRootView rootView = ReactActivityDelegate.this.createRootView();
if (rootView == null) {
rootView = super.createRootView();
}
return rootView;
}
};
}
Expand Down

0 comments on commit da21799

Please sign in to comment.