From 8963e255e6fa5904c13ebf5780b964577c8c5822 Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Thu, 25 Mar 2021 16:23:39 -0700 Subject: [PATCH] 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 --- .../src/ReactNativeFiberInspector.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/react-native-renderer/src/ReactNativeFiberInspector.js b/packages/react-native-renderer/src/ReactNativeFiberInspector.js index 04ddc968d7e8c..ba8474fef23e5 100644 --- a/packages/react-native-renderer/src/ReactNativeFiberInspector.js +++ b/packages/react-native-renderer/src/ReactNativeFiberInspector.js @@ -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, }); }, );