From bbb3a6146cc24d391843bcaf0a451a2876c14056 Mon Sep 17 00:00:00 2001 From: Tianyu Yao Date: Wed, 9 Nov 2022 10:14:11 -0800 Subject: [PATCH] Fix inspecting on non-fabric Summary: Changelog: [Category][Internal] - Fix inspecting on non-fabric the pointer events don't work on non-fabric components. In addition to check the pointer events feature flag, we need to check if fabric is on as well. Reviewed By: rbalicki2 Differential Revision: D41053393 fbshipit-source-id: ab47bd845b578a0859f282ea8ff04ddbff17da02 --- Libraries/Inspector/DevtoolsOverlay.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Libraries/Inspector/DevtoolsOverlay.js b/Libraries/Inspector/DevtoolsOverlay.js index a4711672f6c5f6..d1f08ff1fdacdf 100644 --- a/Libraries/Inspector/DevtoolsOverlay.js +++ b/Libraries/Inspector/DevtoolsOverlay.js @@ -24,6 +24,7 @@ const getInspectorDataForViewAtPoint = require('./getInspectorDataForViewAtPoint const {useEffect, useState, useCallback, useRef} = React; const hook = window.__REACT_DEVTOOLS_GLOBAL_HOOK__; +const isFabric = global.nativeFabricUIManager != null; export default function DevtoolsOverlay({ inspectedView, @@ -179,17 +180,19 @@ export default function DevtoolsOverlay({ let highlight = inspected ? : null; if (isInspecting) { - const events = ReactNativeFeatureFlags.shouldEmitW3CPointerEvents - ? { - onPointerMove, - onPointerDown: onPointerMove, - onPointerUp: stopInspecting, - } - : { - onStartShouldSetResponder: shouldSetResponser, - onResponderMove: onResponderMove, - onResponderRelease: stopInspecting, - }; + const events = + // Pointer events only work on fabric + isFabric && ReactNativeFeatureFlags.shouldEmitW3CPointerEvents + ? { + onPointerMove, + onPointerDown: onPointerMove, + onPointerUp: stopInspecting, + } + : { + onStartShouldSetResponder: shouldSetResponser, + onResponderMove: onResponderMove, + onResponderRelease: stopInspecting, + }; return (