@@ -376,10 +377,14 @@ export default function Tree(props: Props) {
title="Clear all errors and warnings">
-
)}
-
+ {!hideSettings && (
+
+
+
+
+ )}
(
'React::DevTools::defaultTab',
@@ -138,6 +155,25 @@ export default function DevTools({
tab = overrideTab;
}
+ const options = useMemo(
+ () => ({
+ readOnly: readOnly || false,
+ hideSettings: hideSettings || false,
+ hideToggleErrorAction: hideToggleErrorAction || false,
+ hideToggleSuspenseAction: hideToggleSuspenseAction || false,
+ hideLogAction: hideLogAction || false,
+ hideViewSourceAction: hideViewSourceAction || false,
+ }),
+ [
+ readOnly,
+ hideSettings,
+ hideToggleErrorAction,
+ hideToggleSuspenseAction,
+ hideLogAction,
+ hideViewSourceAction,
+ ],
+ );
+
const viewElementSource = useMemo(
() => ({
canViewElementSourceFunction: canViewElementSourceFunction || null,
@@ -210,65 +246,67 @@ export default function DevTools({
return (
-
-
-
-
-
-
-
-
-
-
- {showTabBar && (
-
-
-
- {process.env.DEVTOOLS_VERSION}
-
-
-
+
+
+
+
+
+
+
+
+
+
+ {showTabBar && (
+
+
+
+ {process.env.DEVTOOLS_VERSION}
+
+
+
+
+ )}
+
+
+
+
- )}
-
-
-
-
-
-
-
-
-
-
-
-
-
- {warnIfLegacyBackendDetected && }
- {warnIfUnsupportedVersionDetected && }
-
-
+
+
+
+
+
+
+
+
+ {warnIfLegacyBackendDetected && }
+ {warnIfUnsupportedVersionDetected && }
+
+
+
);
diff --git a/packages/react-devtools-shared/src/devtools/views/context.js b/packages/react-devtools-shared/src/devtools/views/context.js
index a26d704cd28a6..169811b7b901b 100644
--- a/packages/react-devtools-shared/src/devtools/views/context.js
+++ b/packages/react-devtools-shared/src/devtools/views/context.js
@@ -31,3 +31,21 @@ export const ContextMenuContext = createContext({
viewAttributeSourceFunction: null,
});
ContextMenuContext.displayName = 'ContextMenuContext';
+
+export type OptionsContextType = {|
+ readOnly: boolean,
+ hideSettings: boolean,
+ hideToggleErrorAction: boolean,
+ hideToggleSuspenseAction: boolean,
+ hideLogAction: boolean,
+ hideViewSourceAction: boolean,
+|};
+
+export const OptionsContext = createContext({
+ readOnly: false,
+ hideSettings: false,
+ hideToggleErrorAction: false,
+ hideToggleSuspenseAction: false,
+ hideLogAction: false,
+ hideViewSourceAction: false,
+});