mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix selectNode in fabric
Summary: Changelog: [General][Fixed] - Currently selectNode doesn't work for Fabric. Passing the instance instead of a tag to `selectNode` works. Reviewed By: lunaruan Differential Revision: D38851141 fbshipit-source-id: 7640d0f31fb099346a4d8205981e262da6be4990
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2d5db284b0
commit
6163029d4a
@@ -121,8 +121,12 @@ export default function DevtoolsOverlay({
|
||||
locationX,
|
||||
locationY,
|
||||
viewData => {
|
||||
const {touchedViewTag} = viewData;
|
||||
if (touchedViewTag != null) {
|
||||
const {touchedViewTag, closestInstance} = viewData;
|
||||
if (closestInstance != null) {
|
||||
// Fabric
|
||||
agent.selectNode(closestInstance);
|
||||
return true;
|
||||
} else if (touchedViewTag != null) {
|
||||
agent.selectNode(findNodeHandle(touchedViewTag));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -136,13 +136,19 @@ class Inspector extends React.Component<
|
||||
frame,
|
||||
pointerY,
|
||||
touchedViewTag,
|
||||
closestInstance,
|
||||
} = viewData;
|
||||
|
||||
// Sync the touched view with React DevTools.
|
||||
// Note: This is Paper only. To support Fabric,
|
||||
// DevTools needs to be updated to not rely on view tags.
|
||||
if (this.state.devtoolsAgent && touchedViewTag) {
|
||||
this.state.devtoolsAgent.selectNode(findNodeHandle(touchedViewTag));
|
||||
if (this.state.devtoolsAgent) {
|
||||
if (closestInstance != null) {
|
||||
// Fabric
|
||||
this.state.devtoolsAgent.selectNode(closestInstance);
|
||||
} else if (touchedViewTag != null) {
|
||||
this.state.devtoolsAgent.selectNode(findNodeHandle(touchedViewTag));
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({
|
||||
|
||||
Reference in New Issue
Block a user