-
Notifications
You must be signed in to change notification settings - Fork 47.4k
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
React Fabric: Support passing nativeViewTag to getInspectorDataForViewAtPoint callback, for React DevTools compat #21080
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -190,13 +190,21 @@ if (__DEV__) { | |||||||||||||||
|
||||||||||||||||
closestInstance = | ||||||||||||||||
internalInstanceHandle.stateNode.canonical._internalInstanceHandle; | ||||||||||||||||
|
||||||||||||||||
// Note: this is deprecated and we want to remove it ASAP. Keeping it here for React DevTools compatibility for now. | ||||||||||||||||
const nativeViewTag = internalInstanceHandle.stateNode.canonical._nativeTag; | ||||||||||||||||
|
||||||||||||||||
nativeFabricUIManager.measure( | ||||||||||||||||
internalInstanceHandle.stateNode.node, | ||||||||||||||||
(x, y, width, height, pageX, pageY) => { | ||||||||||||||||
const inspectorData = getInspectorDataForInstance( | ||||||||||||||||
getClosestInstanceFromNode(closestInstance), | ||||||||||||||||
); | ||||||||||||||||
callback({ | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regarding why this might not work, is it possible that the code path a few lines up is actually the one being called? (I can breakpoint this later and actually see, just a drive by comment) react/packages/react-native-renderer/src/ReactNativeFiberInspector.js Lines 183 to 189 in 4a99c5c
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I verified that the expected code-path is being hit, so that shouldn't be the root-cause. At that point it would require knowledge of/debugging the DevTools themselves (or the websocket bridget?) so I didn't get much further. But we are getting to this point, and we do have the correct nativeTag, so I'm not sure what's up |
||||||||||||||||
...inspectorData, | ||||||||||||||||
pointerY: locationY, | ||||||||||||||||
frame: {left: pageX, top: pageY, width, height}, | ||||||||||||||||
...getInspectorDataForInstance(closestInstance), | ||||||||||||||||
touchedViewTag: nativeViewTag, | ||||||||||||||||
}); | ||||||||||||||||
}, | ||||||||||||||||
); | ||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this needed for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the change is just a refactor so this codepath looks like the non-Fabric path