From d1d6396c041235f96d496ef0d075e9cc92bfdc89 Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Wed, 14 Feb 2024 03:42:19 -0800 Subject: [PATCH] refactor: remove source usages from getInspectorData Summary: Changelog: [Internal] Required for landing D53543159. 3 reasons for landing this: 1. Inspector is technically deprecated and will be removed once React DevTools are shipped with Chrome DevTools for RN debugging. 2. Long-term solution for source fetching is lazy loading based on component stacks - https://github.com/facebook/react/pull/28265 3. Although `source` field is accumulated and stored, it is not displayed anywhere, see InspectorOverlay.js. Differential Revision: D53757524 --- packages/react-native/Libraries/Inspector/Inspector.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/react-native/Libraries/Inspector/Inspector.js b/packages/react-native/Libraries/Inspector/Inspector.js index 94c32994a781c6..193f8fd0e9a73c 100644 --- a/packages/react-native/Libraries/Inspector/Inspector.js +++ b/packages/react-native/Libraries/Inspector/Inspector.js @@ -38,10 +38,8 @@ type SelectedTab = | 'performance-profiling'; export type InspectedElementFrame = TouchedViewDataAtPoint['frame']; -export type InspectedElementSource = InspectorData['source']; export type InspectedElement = $ReadOnly<{ frame: InspectedElementFrame, - source?: InspectedElementSource, style?: ViewStyleProp, }>; export type ElementsHierarchy = InspectorData['hierarchy']; @@ -74,14 +72,12 @@ function Inspector({ } // We pass in findNodeHandle as the method is injected - const {measure, props, source} = - hierarchyItem.getInspectorData(findNodeHandle); + const {measure, props} = hierarchyItem.getInspectorData(findNodeHandle); measure((x, y, width, height, left, top) => { // $FlowFixMe[incompatible-call] `props` from InspectorData are defined as dictionary, which is incompatible with ViewStyleProp setInspectedElement({ frame: {left, top, width, height}, - source, style: props.style, }); @@ -95,7 +91,6 @@ function Inspector({ hierarchy, props, selectedIndex, - source, frame, pointerY, touchedViewTag, @@ -120,7 +115,6 @@ function Inspector({ // $FlowFixMe[incompatible-call] `props` from InspectorData are defined as dictionary, which is incompatible with ViewStyleProp setInspectedElement({ frame, - source, style: props.style, }); };