From e1840e1c3022cb65550c993cef5c368f517f22cc Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Wed, 24 Mar 2021 15:51:46 -0700 Subject: [PATCH 1/3] React Fabric: Support passing nativeViewTag to getInspectorDataForViewAtPoint callback, for React DevTools compat --- .../src/ReactNativeFiberInspector.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/react-native-renderer/src/ReactNativeFiberInspector.js b/packages/react-native-renderer/src/ReactNativeFiberInspector.js index 04ddc968d7e8c..0416653f293e6 100644 --- a/packages/react-native-renderer/src/ReactNativeFiberInspector.js +++ b/packages/react-native-renderer/src/ReactNativeFiberInspector.js @@ -190,13 +190,21 @@ 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( + getClosestInstanceFromNode(closestInstance), + ); callback({ + ...inspectorData, pointerY: locationY, frame: {left: pageX, top: pageY, width, height}, - ...getInspectorDataForInstance(closestInstance), + touchedViewTag: nativeViewTag, }); }, ); From d6dbb6c40c58dd20cd281f86d24b6e97e64c6375 Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Wed, 24 Mar 2021 17:44:57 -0700 Subject: [PATCH 2/3] update --- packages/react-native-renderer/src/ReactNativeFiberInspector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native-renderer/src/ReactNativeFiberInspector.js b/packages/react-native-renderer/src/ReactNativeFiberInspector.js index 0416653f293e6..b21fd216de75f 100644 --- a/packages/react-native-renderer/src/ReactNativeFiberInspector.js +++ b/packages/react-native-renderer/src/ReactNativeFiberInspector.js @@ -198,7 +198,7 @@ if (__DEV__) { internalInstanceHandle.stateNode.node, (x, y, width, height, pageX, pageY) => { const inspectorData = getInspectorDataForInstance( - getClosestInstanceFromNode(closestInstance), + closestInstance, ); callback({ ...inspectorData, From 95438258d44cefb7f13ff9639c7b840911fc564c Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Thu, 25 Mar 2021 16:02:08 -0700 Subject: [PATCH 3/3] prettier --- .../react-native-renderer/src/ReactNativeFiberInspector.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-native-renderer/src/ReactNativeFiberInspector.js b/packages/react-native-renderer/src/ReactNativeFiberInspector.js index b21fd216de75f..ba8474fef23e5 100644 --- a/packages/react-native-renderer/src/ReactNativeFiberInspector.js +++ b/packages/react-native-renderer/src/ReactNativeFiberInspector.js @@ -192,7 +192,8 @@ if (__DEV__) { 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; + const nativeViewTag = + internalInstanceHandle.stateNode.canonical._nativeTag; nativeFabricUIManager.measure( internalInstanceHandle.stateNode.node,