Skip to content

Commit 18cb4ed

Browse files
mdvaccafacebook-github-bot
authored andcommitted
Ensure legacy architecture can't be initialized in Android (#53806)
Summary: Pull Request resolved: #53806 The Legacy architecture of React Native is not supported anymore, let's ensure nobody can initialize it anymore changelog: [internal] internal Reviewed By: cortinico Differential Revision: D82465004 fbshipit-source-id: 099764fb59d906b11cf6ad0cc6208f56df029d19
1 parent dadd7cd commit 18cb4ed

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,15 @@ public void invokeDefaultOnBackPressed() {
328328
}
329329

330330
registerCxxErrorHandlerFunc();
331+
332+
// Using `if (true)` just to prevent tests / lint errors.
333+
if (true) {
334+
// Legacy architecture of React Native is deprecated and can't be initialized anymore.
335+
// More details on:
336+
// https://github.com/react-native-community/discussions-and-proposals/blob/nc/legacy-arch-removal/proposals/0929-legacy-architecture-removal.md
337+
throw new UnsupportedOperationException(
338+
"ReactInstanceManager.createReactContext is unsupported.");
339+
}
331340
}
332341

333342
private ReactInstanceDevHelper createDevHelperInterface() {
@@ -1446,6 +1455,7 @@ private void tearDownReactContext(ReactContext reactContext) {
14461455
*/
14471456
private ReactApplicationContext createReactContext(
14481457
JavaScriptExecutor jsExecutor, JSBundleLoader jsBundleLoader) {
1458+
14491459
FLog.d(ReactConstants.TAG, "ReactInstanceManager.createReactContext()");
14501460
ReactMarker.logMarker(CREATE_REACT_CONTEXT_START, jsExecutor.getName());
14511461

0 commit comments

Comments
 (0)