Repository navigation
Adds option to allow ViewManagers to capture pointer #8969
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
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 |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| { | ||
| "type": "prerelease", | ||
| "comment": "applying package updates ***NO_CI***", | ||
| "packageName": "react-native-windows", | ||
| "email": "erozell@outlook.com", | ||
| "dependentChangeType": "patch" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,5 +63,17 @@ namespace Microsoft.ReactNative { | |
| get; | ||
| set; | ||
| }; | ||
| DOC_STRING( | ||
| "Gets or sets a flag that allows the ReactRootView to handle pointer " | ||
| "events even when it does not capture the pointer. This is particularly " | ||
| "useful for view managers that seek to capture the pointer to handle " | ||
| "move events for a gesture (e.g., dragging), but conditionally may " | ||
| "allow the ReactRootView to emit events (e.g., if the " | ||
| "@PointerEventKind.End event is received before a drag threshold is hit." | ||
| ) | ||
| Boolean AllowUncaptured { | ||
| get; | ||
|
Member
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. When we have similar concepts in Windows, we call it Handled, and if you don't set it, then the system proceeds to handle it. So maybe rename this to Handled?
Contributor
Author
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. It's a bit more nuanced than Handled. Presumably, if we wanted to prevent the TouchEventHandler from processing an event, we could just subscribe PointerPressed on a view and mark it Handled. This is a related but slightly different concept. TouchEventHandler captures the pointer on PointerPressed (for good reason, so we can track gestures that extend beyond the bounds of the window). If the capture fails, we currently do not track the pointer to fire onTouchStart/Move/End/Cancel. This is an implementation detail of react-native-Windows, not necessarily a XAML concept. What we needed was an ability to tell the TouchEventHandler that it's okay if it can't capture the pointer, continue processing as if that had succeeded. I'm open to better naming alternatives:
The reason I went for AllowUncaptured is that it felt like it could also have the semantics to terminate the gesture in the PointerMoved event when it stops being set by the view manager for subsequent OnPointerEvent callbacks, but I will say this adds complexity to the API. I (now) think that since capture is something that only needs to be dealt with during the PointerPressed event in XAML - it's counter-intuitive to have to keep setting AllowUncaptured to get the move and end events through to React JS. Once we land on a better name, I'll fix that up as well. |
||
| set; | ||
| }; | ||
| } | ||
| } // namespace Microsoft.ReactNative | ||
Uh oh!
There was an error while loading. Please reload this page.