Skip to content

Commit 4fb0b16

Browse files
committed
Rename NativeElement terms to HostInstance in the frontend
The highlight ones are generic. There's a lot of references to Native in the StyleEditor but that one is indeed referring to React Native.
1 parent f9ed4d8 commit 4fb0b16

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

Diff for: packages/react-devtools-shared/src/devtools/views/Components/InspectedElementView.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import InspectedElementStyleXPlugin from './InspectedElementStyleXPlugin';
2222
import InspectedElementSuspenseToggle from './InspectedElementSuspenseToggle';
2323
import NativeStyleEditor from './NativeStyleEditor';
2424
import ElementBadges from './ElementBadges';
25-
import {useHighlightNativeElement} from '../hooks';
25+
import {useHighlightHostInstance} from '../hooks';
2626
import {enableStyleXFeatures} from 'react-devtools-feature-flags';
2727
import {logEvent} from 'react-devtools-shared/src/Logger';
2828
import InspectedElementSourcePanel from './InspectedElementSourcePanel';
@@ -188,8 +188,8 @@ function OwnerView({
188188
isInStore,
189189
}: OwnerViewProps) {
190190
const dispatch = useContext(TreeDispatcherContext);
191-
const {highlightHostInstance, clearHighlightNativeElement} =
192-
useHighlightNativeElement();
191+
const {highlightHostInstance, clearHighlightHostInstance} =
192+
useHighlightHostInstance();
193193

194194
const handleClick = useCallback(() => {
195195
logEvent({
@@ -209,7 +209,7 @@ function OwnerView({
209209
disabled={!isInStore}
210210
onClick={handleClick}
211211
onMouseEnter={() => highlightHostInstance(id)}
212-
onMouseLeave={clearHighlightNativeElement}>
212+
onMouseLeave={clearHighlightHostInstance}>
213213
<span className={styles.OwnerContent}>
214214
<span
215215
className={`${styles.Owner} ${isInStore ? '' : styles.NotInStore}`}

Diff for: packages/react-devtools-shared/src/devtools/views/Components/Tree.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import ComponentSearchInput from './ComponentSearchInput';
3131
import SettingsModalContextToggle from 'react-devtools-shared/src/devtools/views/Settings/SettingsModalContextToggle';
3232
import SelectedTreeHighlight from './SelectedTreeHighlight';
3333
import TreeFocusedContext from './TreeFocusedContext';
34-
import {useHighlightNativeElement, useSubscription} from '../hooks';
34+
import {useHighlightHostInstance, useSubscription} from '../hooks';
3535
import {clearErrorsAndWarnings as clearErrorsAndWarningsAPI} from 'react-devtools-shared/src/backendAPI';
3636
import styles from './Tree.css';
3737
import ButtonIcon from '../ButtonIcon';
@@ -66,8 +66,8 @@ export default function Tree(props: Props): React.Node {
6666
const {hideSettings} = useContext(OptionsContext);
6767
const [isNavigatingWithKeyboard, setIsNavigatingWithKeyboard] =
6868
useState(false);
69-
const {highlightHostInstance, clearHighlightNativeElement} =
70-
useHighlightNativeElement();
69+
const {highlightHostInstance, clearHighlightHostInstance} =
70+
useHighlightHostInstance();
7171
const treeRef = useRef<HTMLDivElement | null>(null);
7272
const focusTargetRef = useRef<HTMLDivElement | null>(null);
7373

@@ -258,7 +258,7 @@ export default function Tree(props: Props): React.Node {
258258
if (selectedElementID !== null) {
259259
highlightHostInstance(selectedElementID);
260260
} else {
261-
clearHighlightNativeElement();
261+
clearHighlightHostInstance();
262262
}
263263
}
264264
}, [
@@ -288,7 +288,7 @@ export default function Tree(props: Props): React.Node {
288288
setIsNavigatingWithKeyboard(false);
289289
}, []);
290290

291-
const handleMouseLeave = clearHighlightNativeElement;
291+
const handleMouseLeave = clearHighlightHostInstance;
292292

293293
// Let react-window know to re-render any time the underlying tree data changes.
294294
// This includes the owner context, since it controls a filtered view of the tree.

Diff for: packages/react-devtools-shared/src/devtools/views/Profiler/CommitFlamegraph.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import NoCommitData from './NoCommitData';
1616
import CommitFlamegraphListItem from './CommitFlamegraphListItem';
1717
import HoveredFiberInfo from './HoveredFiberInfo';
1818
import {scale} from './utils';
19-
import {useHighlightNativeElement} from '../hooks';
19+
import {useHighlightHostInstance} from '../hooks';
2020
import {StoreContext} from '../context';
2121
import {SettingsContext} from '../Settings/SettingsContext';
2222
import Tooltip from './Tooltip';
@@ -101,8 +101,8 @@ function CommitFlamegraph({chartData, commitTree, height, width}: Props) {
101101
useState<TooltipFiberData | null>(null);
102102
const {lineHeight} = useContext(SettingsContext);
103103
const {selectFiber, selectedFiberID} = useContext(ProfilerContext);
104-
const {highlightHostInstance, clearHighlightNativeElement} =
105-
useHighlightNativeElement();
104+
const {highlightHostInstance, clearHighlightHostInstance} =
105+
useHighlightHostInstance();
106106

107107
const selectedChartNodeIndex = useMemo<number>(() => {
108108
if (selectedFiberID === null) {
@@ -134,9 +134,9 @@ function CommitFlamegraph({chartData, commitTree, height, width}: Props) {
134134
);
135135

136136
const handleElementMouseLeave = useCallback(() => {
137-
clearHighlightNativeElement(); // clear highlighting of element on mouse leave
137+
clearHighlightHostInstance(); // clear highlighting of element on mouse leave
138138
setHoveredFiberData(null); // clear hovered fiber data for tooltip
139-
}, [clearHighlightNativeElement]);
139+
}, [clearHighlightHostInstance]);
140140

141141
const itemData = useMemo<ItemData>(
142142
() => ({

Diff for: packages/react-devtools-shared/src/devtools/views/Profiler/CommitRanked.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import HoveredFiberInfo from './HoveredFiberInfo';
1818
import {scale} from './utils';
1919
import {StoreContext} from '../context';
2020
import {SettingsContext} from '../Settings/SettingsContext';
21-
import {useHighlightNativeElement} from '../hooks';
21+
import {useHighlightHostInstance} from '../hooks';
2222
import Tooltip from './Tooltip';
2323

2424
import styles from './CommitRanked.css';
@@ -99,8 +99,8 @@ function CommitRanked({chartData, commitTree, height, width}: Props) {
9999
useState<TooltipFiberData | null>(null);
100100
const {lineHeight} = useContext(SettingsContext);
101101
const {selectedFiberID, selectFiber} = useContext(ProfilerContext);
102-
const {highlightHostInstance, clearHighlightNativeElement} =
103-
useHighlightNativeElement();
102+
const {highlightHostInstance, clearHighlightHostInstance} =
103+
useHighlightHostInstance();
104104

105105
const selectedFiberIndex = useMemo(
106106
() => getNodeIndex(chartData, selectedFiberID),
@@ -116,9 +116,9 @@ function CommitRanked({chartData, commitTree, height, width}: Props) {
116116
);
117117

118118
const handleElementMouseLeave = useCallback(() => {
119-
clearHighlightNativeElement(); // clear highlighting of element on mouse leave
119+
clearHighlightHostInstance(); // clear highlighting of element on mouse leave
120120
setHoveredFiberData(null); // clear hovered fiber data for tooltip
121-
}, [clearHighlightNativeElement]);
121+
}, [clearHighlightHostInstance]);
122122

123123
const itemData = useMemo<ItemData>(
124124
() => ({

Diff for: packages/react-devtools-shared/src/devtools/views/hooks.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,8 @@ export function useSubscription<Value>({
336336
return state.value;
337337
}
338338

339-
export function useHighlightNativeElement(): {
340-
clearHighlightNativeElement: () => void,
339+
export function useHighlightHostInstance(): {
340+
clearHighlightHostInstance: () => void,
341341
highlightHostInstance: (id: number) => void,
342342
} {
343343
const bridge = useContext(BridgeContext);
@@ -361,12 +361,12 @@ export function useHighlightNativeElement(): {
361361
[store, bridge],
362362
);
363363

364-
const clearHighlightNativeElement = useCallback(() => {
364+
const clearHighlightHostInstance = useCallback(() => {
365365
bridge.send('clearHostInstanceHighlight');
366366
}, [bridge]);
367367

368368
return {
369369
highlightHostInstance,
370-
clearHighlightNativeElement,
370+
clearHighlightHostInstance,
371371
};
372372
}

0 commit comments

Comments
 (0)