-
{name}
+
+ {name}
+
{typeof overrideValueFn === 'function' ? (
, value: any) => void;
type KeyValueProps = {|
depth: number,
name: string,
- nameClassName?: string,
overrideValueFn?: ?OverrideValueFn,
path?: Array,
value: any,
@@ -20,7 +19,6 @@ type KeyValueProps = {|
export default function KeyValue({
depth,
name,
- nameClassName = styles.Name,
overrideValueFn,
path = [],
value,
@@ -47,6 +45,9 @@ export default function KeyValue({
displayValue = 'undefined';
}
+ const nameClassName =
+ typeof overrideValueFn === 'function' ? styles.EditableName : styles.Name;
+
children = (
{name}
@@ -66,7 +67,7 @@ export default function KeyValue({
// TODO Is this type even necessary? Can we just drop it?
children = (
- {name}
+ {name}
{getMetaValueLabel(value)}
);
@@ -88,7 +89,7 @@ export default function KeyValue({
className={styles.Item}
style={{ paddingLeft }}
>
-
{name}
+
{name}
Array
);
@@ -110,7 +111,7 @@ export default function KeyValue({
className={styles.Item}
style={{ paddingLeft }}
>
- {name}
+ {name}
Object
);
diff --git a/src/devtools/views/Components/SelectedElement.js b/src/devtools/views/Components/SelectedElement.js
index 2cec5677ba..76b338feec 100644
--- a/src/devtools/views/Components/SelectedElement.js
+++ b/src/devtools/views/Components/SelectedElement.js
@@ -15,7 +15,12 @@ import HooksTree from './HooksTree';
import InspectedElementTree from './InspectedElementTree';
import { hydrate } from 'src/hydration';
import styles from './SelectedElement.css';
-import { ElementTypeClass, ElementTypeFunction } from '../../types';
+import {
+ ElementTypeClass,
+ ElementTypeForwardRef,
+ ElementTypeFunction,
+ ElementTypeMemo,
+} from '../../types';
import type { InspectedElement } from './types';
import type { DehydratedData, Element } from './types';
@@ -145,7 +150,12 @@ function InspectedElementView({
const rendererID = store.getRendererIDForElement(id);
bridge.send('overrideState', { id, path, rendererID, value });
};
- } else if (type === ElementTypeFunction && canEditFunctionProps) {
+ } else if (
+ (type === ElementTypeFunction ||
+ type === ElementTypeMemo ||
+ type === ElementTypeForwardRef) &&
+ canEditFunctionProps
+ ) {
overridePropsFn = (path: Array
, value: any) => {
const rendererID = store.getRendererIDForElement(id);
bridge.send('overrideProps', { id, path, rendererID, value });