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
This commit is contained in:
Tianyu Yao 2022-09-12 16:56:19 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 6163029d4a
Коммит bfb36c2163
1 изменённых файлов: 9 добавлений и 6 удалений

Просмотреть файл

@ -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;