Closed amgleitman closed 2 months ago
It would be good to resolve if we can deterministically create a non-duplicate list of descendantViewTags without relying on throwing away duplicates through a Set, but otherwise this change looks good to me :)
We're now providing the virtual text subviews in a separate array, so this is no longer an issue.
Summary:
We have a feature request to allow mouse hover events for subelements inside a
Text
element. This builds off #2137 to get things all set.For now we're only pushing this into 0.73-stable because we want to take more time to consider the native-side architecture for 0.74 onwards.
One slight drawback is that this only works completely properly when there is only one level of onMouseEnter events underneath the main box. For example, if we move the mouse from red to blue in the below example, we see a "leave red" event immediately before an "enter blue" event. The reason for this is that at the native level, allRCTVirtualTextView
s that represent internalText
nodes are direct children of the parentRCTTextView
instead of directly reflecting the DOM hierarchy. This can potentially be fixed by replacing thesuperview
calls insideupdateHoveredSubviewWithEvent:
with something more appropriate, but this is still sufficient for our needs, so I think it's passable as a first iteration of this PR.Test Plan:
Validated using the following example in RNTester: