From bfb36c21633526fc46f637783b1ff26f2ade1c56 Mon Sep 17 00:00:00 2001 From: Tianyu Yao Date: Mon, 12 Sep 2022 16:56:19 -0700 Subject: [PATCH] Stop inspecting when an element is selected Summary: Changelog: [General][Fixed] In RN devtools, call that method, and then set component state to not inspecting. Reviewed By: lunaruan Differential Revision: D38852009 fbshipit-source-id: d14bd4cc4461f0f7ec4ae9cd6098a58eef3e6ab9 --- Libraries/Inspector/DevtoolsOverlay.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Libraries/Inspector/DevtoolsOverlay.js b/Libraries/Inspector/DevtoolsOverlay.js index 7336241162c56a..a4c780add9ac9c 100644 --- a/Libraries/Inspector/DevtoolsOverlay.js +++ b/Libraries/Inspector/DevtoolsOverlay.js @@ -122,12 +122,15 @@ export default function DevtoolsOverlay({ locationY, viewData => { const {touchedViewTag, closestInstance} = viewData; - if (closestInstance != null) { - // Fabric - agent.selectNode(closestInstance); - return true; - } else if (touchedViewTag != null) { - agent.selectNode(findNodeHandle(touchedViewTag)); + if (closestInstance != null || touchedViewTag != null) { + if (closestInstance != null) { + // Fabric + agent.selectNode(closestInstance); + } else { + agent.selectNode(findNodeHandle(touchedViewTag)); + } + agent.stopInspectingNative(true); + setIsInspecting(false); return true; } return false;