From b67bc3ffd3fe6db3d2fd9e5796bf02815cb29408 Mon Sep 17 00:00:00 2001 From: Lulu Wu Date: Wed, 25 Oct 2023 10:23:29 -0700 Subject: [PATCH] Fix RNTester not showing Redbox when Metro is not connected (#41191) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/41191 In dev mode, display a Redbox for the first fatal error during RN initialization. So if the first fatal error is Metro not connected that will be displayed via Redbox. Changelog: [Android][Changed] - Fix RNTester not showing Redbox when Metro is not connected Reviewed By: cortinico Differential Revision: D50600631 fbshipit-source-id: f269091c1745a76b49e72d9051c4836a39fded12 --- .../main/java/com/facebook/react/runtime/ReactHostImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java index 1b3177d84bfcbb..494aeb61ff15a7 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java @@ -638,6 +638,9 @@ DefaultHardwareBackBtnHandler getDefaultBackButtonHandler() { final String method = "handleHostException(message = \"" + e.getMessage() + "\")"; log(method); + if (DEV) { + mDevSupportManager.handleException(e); + } destroy(method, e); mReactHostDelegate.handleInstanceException(e); }