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
This commit is contained in:
Tianyu Yao 2022-11-09 10:14:11 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 5744b219c7
Коммит bbb3a6146c
1 изменённых файлов: 14 добавлений и 11 удалений

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

@ -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 ? <ElementBox frame={inspected.frame} /> : 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 (
<View
nativeID="devToolsInspectorOverlay"