Skip to content

Commit

Permalink
Fix inspecting on non-fabric
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tyao1 authored and facebook-github-bot committed Nov 9, 2022
1 parent 5744b21 commit bbb3a61
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions Libraries/Inspector/DevtoolsOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit bbb3a61

Please sign in to comment.