Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion packages/react-native/Libraries/LogBox/UI/LogBoxInspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import Keyboard from '../../Components/Keyboard/Keyboard';
import View from '../../Components/View/View';
import StyleSheet from '../../StyleSheet/StyleSheet';
import BackHandler from '../../Utilities/BackHandler';
import * as LogBoxData from '../Data/LogBoxData';
import LogBoxLog, {type LogLevel} from '../Data/LogBoxLog';
import LogBoxInspectorBody from './LogBoxInspectorBody';
Expand All @@ -30,7 +31,7 @@ type Props = Readonly<{
}>;

export default function LogBoxInspector(props: Props): React.Node {
const {logs, selectedIndex} = props;
const {logs, selectedIndex, onMinimize} = props;
let log = logs[selectedIndex];

useEffect(() => {
Expand All @@ -55,6 +56,17 @@ export default function LogBoxInspector(props: Props): React.Node {
Keyboard.dismiss();
}, []);

useEffect(() => {
const subscription = BackHandler.addEventListener(
'hardwareBackPress',
() => {
onMinimize();
return true;
},
);
return () => subscription.remove();
}, [onMinimize]);

function _handleRetry() {
LogBoxData.retrySymbolicateLogNow(log);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ internal class LogBoxDialogSurfaceDelegate(private val devSupportManager: DevSup

dialog = LogBoxDialog(context, reactRootView)
dialog?.let { dialog ->
dialog.setCancelable(false)
dialog.setCancelable(true)
dialog.setCanceledOnTouchOutside(false)
dialog.setOnCancelListener {
devSupportManager.currentReactContext?.emitDeviceEvent("hardwareBackPress")
}
dialog.show()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ internal class RedBoxDialogSurfaceDelegate(private val devSupportManager: DevSup
.apply {
requestWindowFeature(Window.FEATURE_NO_TITLE)
setContentView(checkNotNull(redBoxContentView))
setOnCancelListener { devSupportManager.hideRedboxDialog() }
}
}
dialog?.show()
Expand Down
Loading