Skip to content

Commit

Permalink
Add React DevTools support for Inspector in Fabric
Browse files Browse the repository at this point in the history
  • Loading branch information
rickhanlonii committed May 12, 2020
1 parent 61f2a56 commit f72d1a5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ if (__DEV__) {
const selectedIndex = fiberHierarchy.indexOf(instance);

return {
instance: closestInstance,
hierarchy,
props,
selectedIndex,
Expand Down
37 changes: 26 additions & 11 deletions packages/react-native-renderer/src/ReactNativeTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

import type {ElementRef, AbstractComponent} from 'react';
import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';

export type MeasureOnSuccessCallback = (
x: number,
Expand Down Expand Up @@ -128,17 +129,31 @@ export type InspectorData = $ReadOnly<{|
source: ?InspectorDataSource,
|}>;

export type TouchedViewDataAtPoint = $ReadOnly<{|
pointerY: number,
touchedViewTag?: number,
frame: $ReadOnly<{|
top: number,
left: number,
width: number,
height: number,
|}>,
...InspectorData,
|}>;
export type TouchedViewDataAtPoint =
// Fabric data.
| $ReadOnly<{|
pointerY: number,
instance?: Fiber, // Should this be a host instance (ShadowNode)?
frame: $ReadOnly<{|
top: number,
left: number,
width: number,
height: number,
|}>,
...InspectorData,
|}>
// Paper data.
| $ReadOnly<{|
pointerY: number,
touchedViewTag?: number, // Deprecated, paper only.
frame: $ReadOnly<{|
top: number,
left: number,
width: number,
height: number,
|}>,
...InspectorData,
|}>;

/**
* Flat ReactNative renderer bundles are too big for Flow to parse efficiently.
Expand Down

0 comments on commit f72d1a5

Please sign in to comment.