From debc16a7755fdbf20f17f46a5b598133a1dab316 Mon Sep 17 00:00:00 2001 From: Tommy Nguyen <4123478+tido64@users.noreply.github.com> Date: Tue, 28 Jan 2025 10:30:08 +0100 Subject: [PATCH] chore: handle remote debugging being removed --- example/App.tsx | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/example/App.tsx b/example/App.tsx index 9c53a7842..943f811fc 100644 --- a/example/App.tsx +++ b/example/App.tsx @@ -14,8 +14,6 @@ import { // @ts-expect-error no type definitions available import { version as coreVersion } from "react-native/Libraries/Core/ReactNativeVersion"; import { Colors, Header } from "react-native/Libraries/NewAppScreen"; -// @ts-expect-error no type definitions available -import { isAsyncDebugging } from "react-native/Libraries/Utilities/DebugEnvironment"; declare global { export const RN$Bridgeless: boolean; @@ -186,6 +184,7 @@ function Separator(): React.ReactElement { return ; } +// TODO: Remove this component when we drop support for <0.79 function DevMenu(): React.ReactElement | null { const styles = useStyles(); @@ -193,13 +192,23 @@ function DevMenu(): React.ReactElement | null { return null; } - return ( - - - Remote Debugging - - - ); + // Remote debugging was removed in 0.79: + // https://github.com/facebook/react-native/commit/9aae84a688b5af87faf4b68676b6357de26f797f + try { + const { + isAsyncDebugging, + } = require("react-native/Libraries/Utilities/DebugEnvironment"); + + return ( + + + Remote Debugging + + + ); + } catch (_) { + return null; + } } export function App(props: AppProps): React.ReactElement {