Skip to content

Commit a97b6c7

Browse files
hoxyqfacebook-github-bot
authored andcommitted
fix: pass closest public instance to React DevTools (#46664)
Summary: Pull Request resolved: #46664 # Changelog: [Internal] Please see facebook/react#31068. Synced changes for React Native - D63453667. Differential Revision: D63421463
1 parent 2e248d0 commit a97b6c7

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

packages/react-native/Libraries/Inspector/ReactDevToolsOverlay.js

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,20 +78,15 @@ export default function ReactDevToolsOverlay({
7878
x,
7979
y,
8080
viewData => {
81-
const {touchedViewTag, closestInstance, frame} = viewData;
82-
if (closestInstance != null || touchedViewTag != null) {
83-
// We call `selectNode` for both non-fabric(viewTag) and fabric(instance),
84-
// this makes sure it works for both architectures.
85-
reactDevToolsAgent.selectNode(findNodeHandle(touchedViewTag));
86-
if (closestInstance != null) {
87-
reactDevToolsAgent.selectNode(closestInstance);
88-
}
89-
setInspected({
90-
frame,
91-
});
92-
return true;
81+
const {frame, closestPublicInstance} = viewData;
82+
83+
if (closestPublicInstance == null) {
84+
return false;
9385
}
94-
return false;
86+
87+
reactDevToolsAgent.selectNode(closestPublicInstance);
88+
setInspected({frame});
89+
return true;
9590
},
9691
);
9792
},

0 commit comments

Comments
 (0)