diff --git a/Libraries/Inspector/DevtoolsOverlay.js b/Libraries/Inspector/DevtoolsOverlay.js index 59df46ab2992fb..5f7e89a10ca0f5 100644 --- a/Libraries/Inspector/DevtoolsOverlay.js +++ b/Libraries/Inspector/DevtoolsOverlay.js @@ -30,7 +30,7 @@ export default function DevtoolsOverlay({ inspectedView: ?HostRef, }): React.Node { const [inspected, setInspected] = useState(null); const [isInspecting, setIsInspecting] = useState(false); const devToolsAgentRef = useRef(null); @@ -124,7 +124,7 @@ export default function DevtoolsOverlay({ locationX, locationY, viewData => { - const {touchedViewTag, closestInstance} = viewData; + const {touchedViewTag, closestInstance, frame} = viewData; if (closestInstance != null || touchedViewTag != null) { if (closestInstance != null) { // Fabric @@ -132,8 +132,9 @@ export default function DevtoolsOverlay({ } else { agent.selectNode(findNodeHandle(touchedViewTag)); } - agent.stopInspectingNative(true); - setIsInspecting(false); + setInspected({ + frame, + }); return true; } return false; @@ -143,6 +144,16 @@ export default function DevtoolsOverlay({ [inspectedView], ); + const onResponderRelease = useCallback(() => { + const agent = devToolsAgentRef.current; + if (agent == null) { + return; + } + agent.stopInspectingNative(true); + setIsInspecting(false); + setInspected(null); + }, []); + const shouldSetResponser = useCallback( (e: PressEvent): boolean => { findViewForTouchEvent(e); @@ -157,6 +168,7 @@ export default function DevtoolsOverlay({ {highlight}