Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getInspectorDataForViewAtPoint (take two) #18388

Merged
merged 4 commits into from Mar 30, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -44,7 +44,9 @@ class ReactNativeFiberHostComponent {
this._nativeTag = tag;
this._children = [];
this.viewConfig = viewConfig;
this._internalFiberInstanceHandle = internalInstanceHandle;
if (__DEV__) {
this._internalFiberInstanceHandle = internalInstanceHandle;
rickhanlonii marked this conversation as resolved.
Show resolved Hide resolved
rickhanlonii marked this conversation as resolved.
Show resolved Hide resolved
}
}

blur() {
Expand Down
25 changes: 8 additions & 17 deletions packages/react-native-renderer/src/ReactNativeFiberInspector.js
Expand Up @@ -95,16 +95,7 @@ if (__DEV__) {
hostFiber.stateNode.node;

if (shadowNode) {
nativeFabricUIManager.measure(shadowNode, function(
x,
y,
width,
height,
pageX,
pageY,
) {
callback(x, y, width, height, pageX, pageY);
});
nativeFabricUIManager.measure(shadowNode, callback);
} else {
return UIManager.measure(
getHostNode(fiber, findNodeHandle),
Expand All @@ -123,7 +114,7 @@ if (__DEV__) {
return {
hierarchy: [],
props: emptyObject,
selection: null,
selectedIndex: null,
source: null,
};
}
Expand All @@ -134,12 +125,12 @@ if (__DEV__) {
const hierarchy = createHierarchy(fiberHierarchy);
const props = getHostProps(instance);
const source = instance._debugSource;
const selection = fiberHierarchy.indexOf(instance);
const selectedIndex = fiberHierarchy.indexOf(instance);

return {
hierarchy,
props,
selection,
selectedIndex,
source,
};
};
Expand All @@ -152,7 +143,7 @@ if (__DEV__) {
return {
hierarchy: [],
props: emptyObject,
selection: null,
selectedIndex: null,
source: null,
};
}
Expand All @@ -163,12 +154,12 @@ if (__DEV__) {
const hierarchy = createHierarchy(fiberHierarchy);
const props = getHostProps(instance);
const source = instance._debugSource;
const selection = fiberHierarchy.indexOf(instance);
const selectedIndex = fiberHierarchy.indexOf(instance);

return {
hierarchy,
props,
selection,
selectedIndex,
source,
};
};
Expand Down Expand Up @@ -228,7 +219,7 @@ if (__DEV__) {
});
},
);
} else if (__DEV__) {
} else {
console.error(
'getInspectorDataForViewAtPoint expects to receieve a host component',
);
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-renderer/src/ReactNativeTypes.js
Expand Up @@ -123,7 +123,7 @@ export type InspectorData = $ReadOnly<{|
name: ?string,
getInspectorData: InspectorDataGetter,
|}>,
selection: ?number,
selectedIndex: ?number,
props: InspectorDataProps,
source: ?InspectorDataSource,
|}>;
Expand Down