Skip to content

Commit 59b8bef

Browse files
committed
Add Hover,Focus,Press docs to REAMDE
1 parent 937d262 commit 59b8bef

File tree

1 file changed

+151
-1
lines changed

1 file changed

+151
-1
lines changed

packages/react-events/README.md

Lines changed: 151 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,153 @@
11
# `react-events`
22

3-
This is package is intended for use with the experimental React events API.
3+
*This package is experimental. It is intended for use with the experimental React
4+
events API that is not available in open source builds.*
5+
6+
7+
## Drag
8+
9+
TBC
10+
11+
12+
## Focus
13+
14+
The `Focus` module responds to focus and blur events on the element it wraps.
15+
Focus events are dispatched for `mouse`, `pen`, `touch`, and `keyboard`
16+
pointer types.
17+
18+
```
19+
type FocusEvent = {}
20+
```
21+
22+
### disabled: boolean
23+
24+
Disables all `Focus` events.
25+
26+
### onBlur: (e: FocusEvent) => void
27+
28+
Called when the element loses focus.
29+
30+
### onFocus: (e: FocusEvent) => void
31+
32+
Called when the element gains focus.
33+
34+
### onFocusChange: boolean => void
35+
36+
Called when the element changes hover state (i.e., after `onBlur` and
37+
`onFocus`).
38+
39+
40+
## Hover
41+
42+
The `Hover` module responds to hover events on the element it wraps. Hover
43+
events are only dispatched for `mouse` pointer types. Hover begins when the
44+
pointer enters the element's bounds and ends when the pointer leaves.
45+
46+
```
47+
type HoverEvent = {}
48+
```
49+
50+
### disabled: boolean
51+
52+
Disables all `Hover` events.
53+
54+
### onHoverStart: (e: HoverEvent) => void
55+
56+
Called once the element is hovered. It will not be called if the pointer leaves
57+
the element before the `delayHoverStart` threshold is exceeded. And it will not
58+
be called more than once before `onHoverEnd` is called.
59+
60+
### onHoverEnd: (e: HoverEvent) => void
61+
62+
Called once the element is no longer hovered. It will be cancelled if the
63+
pointer leaves the element before the `delayHoverStart` threshold is exceeded.
64+
65+
### onHoverChange: boolean => void
66+
67+
Called when the element changes hover state (i.e., after `onHoverStart` and
68+
`onHoverEnd`).
69+
70+
### delayHoverStart: number
71+
72+
The duration of the delay between when hover starts and when `onHoverStart` is
73+
called.
74+
75+
### delayHoverEnd: number
76+
77+
The duration of the delay between when hover ends and when `onHoverEnd` is
78+
called.
79+
80+
81+
## Pan
82+
83+
TBC
84+
85+
86+
## Press
87+
88+
The `Press` module responds to press events on the element it wraps. Press
89+
events are dispatched for `mouse`, `pen`, `touch`, and `keyboard` pointer types.
90+
91+
```
92+
type PressEvent = {}
93+
```
94+
95+
### disabled: boolean
96+
97+
Disables all `Press` events.
98+
99+
### onPressStart: (e: PressEvent) => void
100+
101+
Called once the element is pressed down. If the press is released before the
102+
`delayPressStart` threshold is exceeded then the delay is cut short and
103+
`onPressStart` is called immediately.
104+
105+
### onPressEnd: (e: PressEvent) => void
106+
107+
Called once the element is no longer pressed. It will be cancelled if the press
108+
starts again before the `delayPressEnd` threshold is exceeded.
109+
110+
### onPressChange: boolean => void
111+
112+
Called when the element changes press state (i.e., after `onPressStart` and
113+
`onPressEnd`).
114+
115+
### onLongPress: (e: PressEvent) => void
116+
117+
Called once the element has been pressed for the length of `delayLongPress`.
118+
119+
### onLongPressChange: boolean => void
120+
121+
Called when the element changes long-press state.
122+
123+
### onLongPressShouldCancelPress: () => boolean
124+
125+
Determines whether calling `onPress` should be cancelled if `onLongPress` or
126+
`onLongPressChange` have already been called. Default is `false`.
127+
128+
### onPress: (e: PressEvent) => void
129+
130+
Called after `onPressEnd` only if `onLongPressShouldCancelPress` returns
131+
`false`.
132+
133+
### delayPressStart: number
134+
135+
The duration of a delay between when the press starts and when `onPressStart` is
136+
called. This delay is cut short if the press ends released before the threshold
137+
is exceeded.
138+
139+
### delayPressEnd: number
140+
141+
The duration of the delay between when the press ends and when `onPressEnd` is
142+
called.
143+
144+
### delayLongPress: number = 500ms
145+
146+
The duration of a press before `onLongPress` and `onLongPressChange` are called.
147+
148+
### pressRententionOffset: Object
149+
150+
151+
## Swipe
152+
153+
TBC

0 commit comments

Comments
 (0)