Skip to content

Commit 557bafb

Browse files
sbuggaymeta-codesync[bot]
authored andcommitted
Add selectNodeWithViewData to element inspector (#55275)
Summary: Pull Request resolved: #55275 This allows us to leverage the element inspector as a component selector for react-native+livemate. Changelog: [Internal] Reviewed By: jorge-cab, shwanton Differential Revision: D91229666 fbshipit-source-id: 51836eaa794928d71c5a696dd90c6684dec481ff
1 parent 81acf78 commit 557bafb

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

packages/react-native/Libraries/Types/ReactDevToolsTypes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export type ReactDevToolsAgentEvents = {
3333

3434
export type ReactDevToolsAgent = {
3535
selectNode(node: unknown): void,
36+
selectNodeWithViewData(node: mixed): void,
3637
stopInspectingNative(value: boolean): void,
3738
addListener<Event: keyof ReactDevToolsAgentEvents>(
3839
event: Event,

packages/react-native/src/private/devsupport/devmenu/elementinspector/Inspector.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ function Inspector({
107107
if (closestInstance != null) {
108108
reactDevToolsAgent.selectNode(closestInstance);
109109
}
110+
111+
// Attempt to send viewData to React DevTools.
112+
if (reactDevToolsAgent.selectNodeWithViewData) {
113+
reactDevToolsAgent.selectNodeWithViewData(viewData);
114+
}
110115
}
111116

112117
setPanelPosition(

0 commit comments

Comments
 (0)