Repository navigation
Adds hook for view managers to capture pointer events - #8495
23 commits merged into
Conversation
|
Alicia Drummond (@FalseLobster) you might want to look at this - Anyone else that should be looped into this? |
|
Steven Moyes (@stmoy) Chris Glein (@chrisglein) fyi |
fadfd81 to
1200440
Compare
641de1a to
19bf044
Compare
9c89083 to
2397fcc
Compare
ad73947 to
5c04d1d
Compare
5c04d1d to
0649e71
Compare
…e captured in the PointerPressed event
… always called when a child captures the pointer
5646df0 to
1e5e303
Compare
Nick Gerleman (NickGerleman)
left a comment
There was a problem hiding this comment.
Lgtm, in current form with minimal API surface.
|
@msftbot merge in 24 hours |
|
Hello Nick Gerleman (@NickGerleman)! Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:
If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you". |
Alexander Sklar (asklar)
left a comment
There was a problem hiding this comment.
LGTM, let's just update the doc strings so it's a little more clear when these things are triggered/used
|
Alexander Sklar (@asklar) - Updated the DOC_STRINGS in 235e110 |
1903618 to
235e110
Compare
235e110 to
856e8e5
Compare
Alexander Sklar (asklar)
left a comment
There was a problem hiding this comment.
thanks Eric Rozell (@rozele), and for updating the docs : )
|
Hello Alexander Sklar (@asklar)! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
In microsoft#8495, we added an interface for 3rd party view managers to override pointer event handling in the TouchEventHandler module from RNW. The features of this PR supported press events on selectable text, but to generalize this further, we need to allow 3rd party view managers to conditionally cancel pointer event sequences and prevent press events. This change adds the ability for view managers implementing the IViewManagerWithPointerEvents interface to change an "End" event to a "Cancel" event to achieve just that. Fixes microsoft#10202
* Adds gesture cancellation to pointer event handling In #8495, we added an interface for 3rd party view managers to override pointer event handling in the TouchEventHandler module from RNW. The features of this PR supported press events on selectable text, but to generalize this further, we need to allow 3rd party view managers to conditionally cancel pointer event sequences and prevent press events. This change adds the ability for view managers implementing the IViewManagerWithPointerEvents interface to change an "End" event to a "Cancel" event to achieve just that. Fixes #10202 * Change files
…#10203) In microsoft#8495, we added an interface for 3rd party view managers to override pointer event handling in the TouchEventHandler module from RNW. The features of this PR supported press events on selectable text, but to generalize this further, we need to allow 3rd party view managers to conditionally cancel pointer event sequences and prevent press events. This change adds the ability for view managers implementing the IViewManagerWithPointerEvents interface to change an "End" event to a "Cancel" event to achieve just that. Fixes microsoft#10202
Closes #8499
Currently, there is no way for ViewManagers to capture the pointer to perform it's own pointer event handling. This change introduces a new interface,
IViewManagerWithPointerEvents, so third party modules can be notified when the ReactRootView receives pointer events. The behavior is as follows:ViewManagerBaseadds a virtual method:OnPointerEvent(object sender, ReactPointerEventArgs args)We have a
ReactPointerEventArgswrapper aroundPointerRoutedEventArgsthat view managers can use to:PreventDefaultto suppress the corresponding React event from being emittedReleaseCaptureto force the TouchEventEmitter to release pointer capture (triggering anonTouchCancelevent to React Native)Targetproperty to refine for hit testingThe
ReactPointerEventArgswrapper also includes an enumKindvalue for the type of pointer event so we can reduce the number of methods that need to be implemented for this interface.TODO:
OnPointerMovedrather than invokingOnPointerConcluded.Add custom view manager example that uses this API.N/A since we now leverage these APIs in core view managersonMouseEnter/onMouseLeaveevents: The current approach should start onMouseEnter / onMouseLeave events at the ReactPointerEventArgs.Target() element.We will need to update a few other PRs to leverage these APIs once they merge:
OnPointer*APIs for Text hit testingPreventDefaultto suppressOnPointerCaptureLostfrom firing anonTouchCanceleventMicrosoft Reviewers: Open in CodeFlow