-
Notifications
You must be signed in to change notification settings - Fork 46.8k
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
Fix use of stale props in Fabric events #26408
Changes from all commits
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 |
---|---|---|
|
@@ -24,10 +24,10 @@ function getInstanceFromTag(tag) { | |
function getTagFromInstance(inst) { | ||
let nativeInstance = inst.stateNode; | ||
let tag = nativeInstance._nativeTag; | ||
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. Should we rename these methods? It's already exported as 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 still need to do some more work on the react repo for this. Can do that in a following PR. |
||
if (tag === undefined) { | ||
if (tag === undefined && nativeInstance.canonical != null) { | ||
// For compatibility with Fabric | ||
tag = nativeInstance.nativeTag; | ||
nativeInstance = nativeInstance.publicInstance; | ||
tag = nativeInstance.canonical.nativeTag; | ||
nativeInstance = nativeInstance.canonical.publicInstance; | ||
} | ||
|
||
if (!tag) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,10 +223,11 @@ function getInspectorDataForViewAtPoint( | |
} | ||
|
||
closestInstance = | ||
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. This was previously using a private property on 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.
Yeah.
There's another one in 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. Just trying to see if we can avoid the prop and re-use the existing one, but since this is now on canonical, it probably doesn't matter as much. 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. We could use symbol properties on the public instance to avoid creating new properties and keep encapsulation, but I want to make public instances lazy and that would prevent me from doing it. |
||
internalInstanceHandle.stateNode.internalInstanceHandle; | ||
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.nativeTag; | ||
const nativeViewTag = | ||
internalInstanceHandle.stateNode.canonical.nativeTag; | ||
|
||
nativeFabricUIManager.measure( | ||
node, | ||
|
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.
Why do we need a null-check here? The types claim these are all non-nullable.
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.
I don't remember why I did the original check (should've added a comment) but there's some code like this for compatibility with Paper, so types don't match 1:1. I'll double check.