Commit Graph
45 Commits
Author SHA1 Message Date
Dominic GannawayandGitHub 784ebd8fa9 Experimental event API: rework the propagation system for event components (#15462) 2019-04-23 11:50:48 +01:00
Nicolas GallagherandGitHub 587676900f React events: initial implementation of disabled prop (#15458) 2019-04-21 18:17:18 -07:00
Nicolas GallagherandGitHub 59c7aef91d React events: add a test for focusable descendants (#15457) 2019-04-21 17:47:52 -07:00
Nicolas GallagherandGitHub d584fcdc6e React events: use passive events where possible (#15454) 2019-04-19 13:09:03 -07:00
Nicolas GallagherandGitHub 051513bfa0 React Events: consolidate logic for Press event component (#15451)
Refactor of Press and additional regression coverage.

The logic for "start", "move", "end", and "cancel" events is consolidated into a single block to reduce duplication and improve consistency of the UX across input-types. Also reduces code size.

The bailout logic for anchor tags is removed since we preventDefault for click by default. We can discuss scenarios where it makes sense to limit functionality around interactions on anchor tags.

The logic for ignoring emulated events is simplified and improved. Pointer events can produce emulated touch (immediately after pointer) and mouse events (delayed) which is now accounted for and tested.
2019-04-19 10:05:28 -07:00
Nicolas GallagherandGitHub cdfce1ad23 React events: consolidate logic of Hover event component (#15450)
Minor refactor of Hover and additional regression coverage.
2019-04-19 09:51:36 -07:00
Nicolas GallagherandGitHub 5857c89da2 React events: extract common helper functions (#15449) 2019-04-19 08:40:18 -07:00
Nicolas GallagherandGitHub 1ae409d2c7 React events: fix nested Hover components error (#15428)
* Add failing test for nested Hover
* Fix error caused by nested Hover event components
2019-04-17 11:33:32 -07:00
Nicolas GallagherandGitHub c73ab39c1f React events: make nested Focus work as expected (#15421)
This patch makes a change to the Focus module so that it only reports
focus/blur on the host node that's a direct child of the event component. This
brings the expected behaviour in line with the browser default of focus/blur
events not bubbling for Pressable.
2019-04-16 11:16:27 -07:00
Dominic GannawayandGitHub 9ebe1768a8 Experimental Event API: Redesign event responder propagation (#15408)
* Event API: Redesign event instance propagation
2019-04-13 20:37:39 +01:00
Nicolas GallagherandGitHub 8cf963c6c3 React events: ignore device buttons that aren't for primary interactions (#15402)
The Pointer Events spec mentions that the value of `button` in a nativeEvent
can be anything between 0 and 5 for "down" events. We only care about those
with a value of 0.
2019-04-12 13:36:00 -07:00
Dominic GannawayandGitHub 3438e5ce87 Experimental Event API: Add Hover onUnmount support (#15394) 2019-04-12 13:26:27 +01:00
Nicolas GallagherandDominic Gannaway 805e7f8733 React events: add unmounting to Focus (#15396) 2019-04-12 12:23:03 +01:00
Dominic GannawayandGitHub 543353a043 Experimental Event API: Remove "listener" from event objects (#15391) 2019-04-12 11:53:40 +01:00
Nicolas GallagherandGitHub 4e59d4f5d2 React events: add onHoverMove support (#15388) 2019-04-11 18:59:05 -07:00
Nicolas GallagherandGitHub 45473c94cd React events: Press event fixes (#15386)
1. Fix hiding context menu for longpress via touch.
2. Fix scrolling of viewport for longpress via spacebar key.
3. Add tests for anchor-related behaviour and preventDefault.
4. Add a deactivation delay for forced activation
5. Add pointerType to Press events.

NOTE: this currently extends pointerType to include `keyboard`.

NOTE: React Native doesn't have a deactivation delay for forced activation, but this is possibly because of the async bridge meaning that the events aren't dispatched sync.
2019-04-11 13:20:21 -07:00
Dominic GannawayandGitHub 9672cf621b Experimental Event API: adds stopPropagation by default to Press (#15384) 2019-04-11 20:00:20 +01:00
Dominic GannawayandGitHub a9eff329c6 Remove TouchHitTarget SSR logic to prevent issues with mouse events (#15381) 2019-04-11 12:05:26 +01:00
Dominic GannawayandGitHub c9841001b0 Experimental Event API: preventDefault handling for anchors (#15383) 2019-04-11 12:04:39 +01:00
Dominic GannawayandGitHub 3e2e930d62 Fixes a Flow type merge conflict (#15378) 2019-04-10 19:33:05 +01:00
Nicolas GallagherandGitHub 7fc91f17c9 React events: add onPressMove and pressRetentionOffset to Press (#15374)
This implementation differs from equivalents in React Native in the following ways:

1. A move during a press will not cancel onLongPress.
2. A move to outside the retention target will cancel the press and not
reactivate when moved back within the retention target.
2019-04-10 10:52:50 -07:00
Dominic GannawayandGitHub dd9cef9fc0 Experimental Event API: Add targets and responder utility method for finding targets (#15372) 2019-04-10 18:52:34 +01:00
Dominic GannawayandGitHub c64b330032 Move EventTypes to ReactTypes (#15364) 2019-04-10 09:55:56 +01:00
Nicolas GallagherandGitHub 81a61b1d1a React events: add delay props to Press module (#15340)
* Add delay props to Press event module
* Minor naming changes to Hover events
* Add examples to react-events README
2019-04-06 13:47:28 -07:00
Dominic GannawayandGitHub 4064ea9fa6 Experimental event API: Support EventComponent onUnmount responder callback (#15335) 2019-04-06 08:16:57 +01:00
Dominic GannawayandGitHub 4fbbae8afa Add full TouchHitTarget hit slop (experimental event API) to ReactDOM (#15308) 2019-04-06 07:51:21 +01:00
Nicolas GallagherandDominic Gannaway 958b6173fd Add delay props to Hover event module (#15325) 2019-04-05 12:23:51 +01:00
Dominic GannawayandGitHub b93a8a9bb8 Experimental event API: refactor responder modules for lifecycle inclusion (#15322) 2019-04-04 23:28:23 +01:00
Nicolas GallagherandGitHub 937d262f55 React events: keyboard press, types, tests (#15314)
* Add HoverProps type
* Add more Hover event module tests
* Add more Press event module tests
* Change default longPress delay from 1000 to 500
* Rename dispatchPressEvent -> dispatchEvent
* Consolidate state updates in Press event module
* Add keyboard support for Press events
* Add FocusProps type and unit tests
2019-04-04 08:55:35 -07:00
Behzad AbbasiandDominic Gannaway 73187239af writing unit tests in experimental event Drag API (#15297)
* writing unit tests in experimental event Drag API

* add onDragMove unit test

* fix dragstart event type
2019-04-03 12:30:57 +01:00
Dominic GannawayandGitHub 89064fe68d Adds displayName to EventComponent and EventTarget (#15268)
* Adds displayName to EventComponent and EventTarget
2019-04-03 12:24:25 +01:00
Dominic GannawayandGitHub 38fa84088a Experiemental event API - wrap async dispatched events (#15299) 2019-04-03 10:25:40 +01:00
Dominic GannawayandGitHub 9307932fe5 Refactor event object creation for the experimental event API (#15295)
* Refactor event object creation for the experimental event API
2019-04-02 20:03:11 +01:00
Dominic GannawayandGitHub 6a1e6b2f78 Experimental event API: loosen EventTarget constraints and warnings (#15292)
* Remove warning for event targets being direct children of event component

* Addressed feedback and added more test coverage + warnings
2019-04-02 19:49:28 +01:00
Nicolas GallagherandDominic Gannaway f243deab82 Add tests for Press responder event module (#15290)
* Add Press responder event tests

Behavior being tested takes cues from React Native's Pressability.
A couple of these tests fail and require the Press implementation to be patched.
2019-04-02 16:49:41 +01:00
Nicolas GallagherandDominic Gannaway 296c4393da Add Press event prop types and fix a check in Safari (#15288)
* Add PressProps type to event module

* Move default Press event delays to constants

* Fix right-click press check for Safari

* Prettier and Linter

* Use event.key in press responder

event.keyCode is a deprecated API

* Remove unused props from Press event module
2019-04-02 14:42:37 +01:00
Behzad AbbasiandDominic Gannaway 5ef0d1d29d Rename hover props in experimental event API and write unit tests (#15283)
* Rename hover props in experimental event API and write unit tests
2019-04-01 16:19:16 +01:00
Nicolas GallagherandDominic Gannaway 7f1f5ddc33 Rename press props in experimental event API (#15263)
Note: this is for an experimental event API that we're testing out internally at Facebook.

* onPressIn -> onPressStart
* onPressOut -> onPressEnd
* longPressCancelsPress -> onLongPressShouldCancelPress
2019-03-30 16:23:41 +00:00
Nicolas GallagherandDominic Gannaway 08055a625e Fix Press module in experimental event API (#15262)
Note: this is for an experimental event API that we're testing out internally at Facebook.

Fixes a regression in f4625f5182
2019-03-29 14:26:55 -07:00
Nicolas GallagherandDominic Gannaway f4625f5182 Fix on(Long)PressChange events in experimental press event API (#15256)
Make sure that `onPressChange` is only called if `longPressCancelsPress` is `false`.
And make sure that `onLongPressChange` is called when a long press ends.
2019-03-29 11:58:29 -07:00
Dominic GannawayandGitHub a41b217708 Add additional event API responder surfaces (#15248)
* Add rest of event modules + small fixes
2019-03-29 10:31:18 -07:00
Nicolas GallagherandDominic Gannaway 700f17be67 Fix longpress in experimental Press event module (#15246)
The 'longpress' event is dispatched during a press interaction, rather than
after it has ended.

The 'longPressCancelsPress' prop can be used to prevent 'press' being
dispatched if 'longpress' has already been dispatched.
2019-03-28 21:44:28 -07:00
Dominic GannawayandGitHub 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 GannawayandGitHub daeda44d8f Follow up to 15150 (#15152) 2019-03-19 20:55:04 +00:00
Dominic GannawayandGitHub 55cc921c5d Adds react-events package for internal testing (#15150)
* Adds react-events package for internal testing
2019-03-19 15:12:45 +00:00