Skip to content

Commit

Permalink
React Fabric: Support passing nativeViewTag to getInspectorDataForVie…
Browse files Browse the repository at this point in the history
…wAtPoint callback, for React DevTools compat (#21080)

React Fabric: Support passing nativeViewTag to getInspectorDataForViewAtPoint callback, for React DevTools compat
  • Loading branch information
JoshuaGross authored Mar 25, 2021
1 parent a7c5726 commit 1b7e471
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/react-native-renderer/src/ReactNativeFiberInspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,22 @@ if (__DEV__) {

closestInstance =
internalInstanceHandle.stateNode.canonical._internalInstanceHandle;

// Note: this is deprecated and we want to remove it ASAP. Keeping it here for React DevTools compatibility for now.
const nativeViewTag =
internalInstanceHandle.stateNode.canonical._nativeTag;

nativeFabricUIManager.measure(
internalInstanceHandle.stateNode.node,
(x, y, width, height, pageX, pageY) => {
const inspectorData = getInspectorDataForInstance(
closestInstance,
);
callback({
...inspectorData,
pointerY: locationY,
frame: {left: pageX, top: pageY, width, height},
...getInspectorDataForInstance(closestInstance),
touchedViewTag: nativeViewTag,
});
},
);
Expand Down

0 comments on commit 1b7e471

Please sign in to comment.