Commit Graph

14 Commits

Author SHA1 Message Date
Nicolas Gallagher 9ce8711d5a [react-events] Tap responder (#16628)
This is a partial replacement for the 'Press' responder:

1. `useTap` is scoped to pointers (no keyboard support). Our current thinking is
that "responders" should be limited to working with pointers, and that they can
be combined with 'useKeyboard' in user-space. For example, we might create a
'usePress' hook in user-space that combines 'useTap' with 'useKeyboard' to react
to both pointers and keyboard interactions.

2. `useTap` cancels the gesture once the pointer moves over an element that is
not within the responder target's subtree. This differs from `usePress` (and
React Native), where the gesture remains active after the pointer exits the
target's subtree and is restarted once the pointer reenters. One of the
drawbacks with the `usePress` behavior is that it requires repeatedly measuring
DOM elements (which can cause jank) to perform hit region tests. `useTap` avoids
doing this and relies on `document.elementFromPoint` only to support the
TouchEvent fallbacks.

3. `useTap` calls `onTapUpdate` when the active gesture's state changes,
`onTapEnd` when the gesture successfully completes. and `onTapCancel` when it
fails. There is no `onTap` callback. `usePress` did not explicitly report back
when the gesture failed, and product developers were confused about the
difference between `onPress` and `onPressEnd`.

4. `useTap` explicitly separates the PointerEvent implementation from the
MouseEvent/TouchEvent fallback.

5. `useTap` has better unit test coverage . All pointer types and the fallback
environment are tested. The shape of the gesture state object is also defined
and tested.
2019-09-04 17:09:33 -07:00
Nicolas Gallagher 23405c9c4c [react-events] Add ContextMenu responder (#16296)
A module for responding to contextmenu events. This functionality will be
removed from the Press responder in the future.
2019-08-06 09:16:05 -07:00
Dominic Gannaway b5af4fe3c6 Remove FocusScope (#16267) 2019-07-31 17:40:11 +01:00
Dominic Gannaway e0472709c8 [Flare] Adds Keyboard event responder (#16204) 2019-07-25 17:47:44 +01:00
Dominic Gannaway 65b80fdd94 [Flare] Add Input event responder surface (#16148) 2019-07-17 21:04:41 +01:00
Dominic Gannaway 8b88ac2592 [Flare] Remove event targets including TouchHitTarget (#16011) 2019-06-27 23:58:48 +01:00
Dominic Gannaway 73c27d8b49 [Flare] Add basic Scroll event responder module (#15827) 2019-06-05 18:20:34 +01:00
Nicolas Gallagher 89d8d1435f Add React.unstable_createEventComponent (#15580)
API for creating event components from event responders.
2019-05-07 12:36:42 -07:00
Dominic Gannaway 379515e83e Follow up to 15535 (#15536) 2019-04-30 12:04:19 +01:00
Dominic Gannaway 64e3da286f Event API: Add FocusScope surface (#15487) 2019-04-25 02:01:09 +01:00
Sunil Pai 92a1d8feac mark react-events as private so we publish script skips it for now (#15307) 2019-04-03 17:22:51 +01:00
Dominic Gannaway a41b217708 Add additional event API responder surfaces (#15248)
* Add rest of event modules + small fixes
2019-03-29 10:31:18 -07:00
Dominic Gannaway 669cafb36f Adds experimental event component responder surfaces (#15228)
* Adds Press and Hover event modules + more features to the Event Responder System
2019-03-27 16:42:17 -07:00
Dominic Gannaway 55cc921c5d Adds react-events package for internal testing (#15150)
* Adds react-events package for internal testing
2019-03-19 15:12:45 +00:00