diff --git a/src/devtools/views/Components/Element.js b/src/devtools/views/Components/Element.js
index d7a03e9667..845522b1c1 100644
--- a/src/devtools/views/Components/Element.js
+++ b/src/devtools/views/Components/Element.js
@@ -39,7 +39,12 @@ export default function ElementView({ data, index, style }: Props) {
const [isHovered, setIsHovered] = useState(false);
- const { isNavigatingWithKeyboard, onElementMouseEnter, treeFocused } = data;
+ const {
+ isNavigatingWithKeyboard,
+ onElementMouseEnter,
+ showIndentLines,
+ treeFocused,
+ } = data;
const id = element === null ? null : element.id;
const isSelected = selectedElementID === id;
@@ -100,14 +105,24 @@ export default function ElementView({ data, index, style }: Props) {
onMouseLeave={handleMouseLeave}
onMouseDown={handleMouseDown}
onDoubleClick={handleDoubleClick}
- style={{
- ...style, // "style" comes from react-window
-
- // Left padding presents the appearance of a nested tree structure.
- // We must use padding rather than margin/left because of the selected background color.
- paddingLeft: `calc(${depth} * var(--indentation-size))`,
- }}
+ style={style}
>
+ {depth > 0 && (
+
+ )}
+
{ownerID === null ? (
) : null}
diff --git a/src/devtools/views/Components/Tree.js b/src/devtools/views/Components/Tree.js
index 3e5b75f99e..57644a7adb 100644
--- a/src/devtools/views/Components/Tree.js
+++ b/src/devtools/views/Components/Tree.js
@@ -32,6 +32,7 @@ export type ItemData = {|
isNavigatingWithKeyboard: boolean,
lastScrolledIDRef: { current: number | null },
onElementMouseEnter: (id: number) => void,
+ showIndentLines: boolean,
treeFocused: boolean,
|};
@@ -59,7 +60,7 @@ export default function Tree(props: Props) {
const [treeFocused, setTreeFocused] = useState(false);
- const { lineHeight } = useContext(SettingsContext);
+ const { lineHeight, showIndentLines } = useContext(SettingsContext);
// Make sure a newly selected element is visible in the list.
// This is helpful for things like the owners list and search.
@@ -263,6 +264,7 @@ export default function Tree(props: Props) {
isNavigatingWithKeyboard,
onElementMouseEnter: handleElementMouseEnter,
lastScrolledIDRef,
+ showIndentLines,
treeFocused,
}),
[
@@ -270,6 +272,7 @@ export default function Tree(props: Props) {
isNavigatingWithKeyboard,
handleElementMouseEnter,
lastScrolledIDRef,
+ showIndentLines,
treeFocused,
]
);
diff --git a/src/devtools/views/Settings/Settings.js b/src/devtools/views/Settings/Settings.js
index 645ee25422..30b83803cc 100644
--- a/src/devtools/views/Settings/Settings.js
+++ b/src/devtools/views/Settings/Settings.js
@@ -11,9 +11,14 @@ import styles from './Settings.css';
function Settings(_: {||}) {
const store = useContext(StoreContext);
- const { displayDensity, setDisplayDensity, theme, setTheme } = useContext(
- SettingsContext
- );
+ const {
+ displayDensity,
+ setDisplayDensity,
+ showIndentLines,
+ setShowIndentLines,
+ theme,
+ setTheme,
+ } = useContext(SettingsContext);
const captureScreenshotsSubscription = useMemo(
() => ({
@@ -57,6 +62,13 @@ function Settings(_: {||}) {
[setTheme]
);
+ const updateShowIndentLines = useCallback(
+ ({ currentTarget }) => {
+ setShowIndentLines(currentTarget.checked);
+ },
+ [setShowIndentLines]
+ );
+
const updateCaptureScreenshotsWhileProfiling = useCallback(
({ currentTarget }) => {
store.captureScreenshots = currentTarget.checked;
@@ -143,6 +155,14 @@ function Settings(_: {||}) {
/>{' '}
Collapse newly added components by default
+
{store.supportsCaptureScreenshots && (
diff --git a/src/devtools/views/Settings/SettingsContext.js b/src/devtools/views/Settings/SettingsContext.js
index 4f79131554..ac371cbec7 100644
--- a/src/devtools/views/Settings/SettingsContext.js
+++ b/src/devtools/views/Settings/SettingsContext.js
@@ -16,6 +16,9 @@ type Context = {|
// Specified as a separate prop so it can trigger a re-render of FixedSizeList.
lineHeight: number,
+ showIndentLines: boolean,
+ setShowIndentLines: (value: boolean) => void,
+
theme: Theme,
setTheme(value: Theme): void,
|};
@@ -44,6 +47,10 @@ function SettingsContextController({
'React::DevTools::displayDensity',
'compact'
);
+ const [showIndentLines, setShowIndentLines] = useLocalStorage(
+ 'React::DevTools::showIndentLines',
+ true
+ );
const [theme, setTheme] = useLocalStorage(
'React::DevTools::theme',
'auto'
@@ -126,6 +133,8 @@ function SettingsContextController({
setDisplayDensity,
theme,
setTheme,
+ showIndentLines,
+ setShowIndentLines,
lineHeight:
displayDensity === 'compact'
? compactLineHeight
@@ -135,7 +144,9 @@ function SettingsContextController({
comfortableLineHeight,
compactLineHeight,
displayDensity,
+ showIndentLines,
setDisplayDensity,
+ setShowIndentLines,
setTheme,
theme,
]