Skip to content

Commit 1b7e471

Browse files
authored
React Fabric: Support passing nativeViewTag to getInspectorDataForViewAtPoint callback, for React DevTools compat (#21080)
React Fabric: Support passing nativeViewTag to getInspectorDataForViewAtPoint callback, for React DevTools compat
1 parent a7c5726 commit 1b7e471

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/react-native-renderer/src/ReactNativeFiberInspector.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,22 @@ if (__DEV__) {
190190

191191
closestInstance =
192192
internalInstanceHandle.stateNode.canonical._internalInstanceHandle;
193+
194+
// Note: this is deprecated and we want to remove it ASAP. Keeping it here for React DevTools compatibility for now.
195+
const nativeViewTag =
196+
internalInstanceHandle.stateNode.canonical._nativeTag;
197+
193198
nativeFabricUIManager.measure(
194199
internalInstanceHandle.stateNode.node,
195200
(x, y, width, height, pageX, pageY) => {
201+
const inspectorData = getInspectorDataForInstance(
202+
closestInstance,
203+
);
196204
callback({
205+
...inspectorData,
197206
pointerY: locationY,
198207
frame: {left: pageX, top: pageY, width, height},
199-
...getInspectorDataForInstance(closestInstance),
208+
touchedViewTag: nativeViewTag,
200209
});
201210
},
202211
);

0 commit comments

Comments
 (0)