From b72c4c3abd1dee9a9f371e58cbf62dd37a19c95c Mon Sep 17 00:00:00 2001 From: Tianyu Yao Date: Wed, 5 Oct 2022 23:23:50 -0700 Subject: [PATCH] Return lastNonHostInstance in getInspectorDataForInstance for devtools --- packages/react-native-renderer/src/ReactNativeFiberInspector.js | 2 +- packages/react-native-renderer/src/ReactNativeTypes.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-native-renderer/src/ReactNativeFiberInspector.js b/packages/react-native-renderer/src/ReactNativeFiberInspector.js index 874ac91d84734..2cc3c4ca8bf3b 100644 --- a/packages/react-native-renderer/src/ReactNativeFiberInspector.js +++ b/packages/react-native-renderer/src/ReactNativeFiberInspector.js @@ -112,6 +112,7 @@ if (__DEV__ || enableGetInspectorDataForInstanceInProduction) { const selectedIndex = fiberHierarchy.indexOf(instance); return { + closestInstance: instance, hierarchy, props, selectedIndex, @@ -225,7 +226,6 @@ if (__DEV__) { pointerY: locationY, frame: {left: pageX, top: pageY, width, height}, touchedViewTag: nativeViewTag, - closestInstance, }); }, ); diff --git a/packages/react-native-renderer/src/ReactNativeTypes.js b/packages/react-native-renderer/src/ReactNativeTypes.js index 5eef1a6dff9c9..0b0a57b895961 100644 --- a/packages/react-native-renderer/src/ReactNativeTypes.js +++ b/packages/react-native-renderer/src/ReactNativeTypes.js @@ -138,6 +138,7 @@ type InspectorDataGetter = ( }>; export type InspectorData = $ReadOnly<{ + closestInstance?: mixed, hierarchy: Array<{ name: ?string, getInspectorData: InspectorDataGetter, @@ -150,7 +151,6 @@ export type InspectorData = $ReadOnly<{ export type TouchedViewDataAtPoint = $ReadOnly<{ pointerY: number, touchedViewTag?: number, - closestInstance?: mixed, frame: $ReadOnly<{ top: number, left: number,