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 onMouseEnter and onMouseLeave to Text (cherry-picked from 0.73-stable) #2149

Merged
merged 6 commits into from
Jul 27, 2024

Conversation

amgleitman
Copy link
Member

@amgleitman amgleitman commented Jul 26, 2024

Summary:

This mainly brings over #2137 and #2143 from 0.73-stable into the main branch. We also add an example in RNTester and do some housekeeping on our TypeScript types.

Commit descriptions:

  • Move various Mac-specific props from RCTView to its parent class RCTUIView. Theoretically these can be used for any sort of view, not just <View>. They're still "opt-in" from the JS side, so there won't be any side effects for other views that don't care about these properties.
  • Hooks up onMouseEnter and onMouseLeave to <Text> views.

Test Plan:

Validated the new test case in RNTester as well as in other external test apps.

amgleitman and others added 4 commits July 25, 2024 16:16
* Move mouse events from RCTView to superclass RCTUIView

* Add focus and responder events

* Move mouse event implementations to RCTUIView class

---------

Co-authored-by: Adam Gleitman <adgleitm@microsoft.com>
* Initial implementation

* Refactor and dedupe some code

* Basic error handling

* Clarify comment about mousemove order

* Cleanup: enumerate all text attributes at once instead of doing multiple passes

* Use *shadow* view traversal for handling nested mouse events

* Remove potentially confusing comment

* descendantViewTags doesn't need to worry about duplicates

* Distinguish between embedded views and virtual text subviews

* Scope _virtualSubviews to macOS only

* nit: use separate #if blocks for `setTextStorage:...` and `getRectForCharRange:` inclusions

* TARGET_OS_OSX blocks for virtualSubviewTags

* Remove #if TARGET_OS_OSX blocks, since these changes are potentially upstreamable

* Clarify a TODO

---------

Co-authored-by: Adam Gleitman <adgleitm@microsoft.com>
@amgleitman amgleitman requested a review from a team as a code owner July 26, 2024 21:30
@amgleitman amgleitman changed the title Cherry pick updates from 0.73 Add onMouseEnter and onMouseLeave to Text (cherry-picked from 0.73-stable) Jul 26, 2024
@amgleitman amgleitman merged commit 10b1cd8 into microsoft:main Jul 27, 2024
14 checks passed
@amgleitman amgleitman deleted the cherry-pick-updates-from-0.73 branch July 27, 2024 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants