-
Notifications
You must be signed in to change notification settings - Fork 47k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
React Events: core API documentation (#15505)
- Loading branch information
Showing
5 changed files
with
344 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
## Focus | ||
|
||
The `Focus` module responds to focus and blur events on its child. Focus events | ||
are dispatched for `mouse`, `pen`, `touch`, and `keyboard` | ||
pointer types. | ||
|
||
Focus events do not propagate between `Focus` event responders. | ||
|
||
```js | ||
// Example | ||
const TextField = (props) => ( | ||
<Focus | ||
onBlur={props.onBlur} | ||
onFocus={props.onFocus} | ||
> | ||
<textarea></textarea> | ||
</Focus> | ||
); | ||
``` | ||
|
||
```js | ||
// Types | ||
type FocusEvent = { | ||
target: Element, | ||
type: 'blur' | 'focus' | 'focuschange' | ||
} | ||
``` | ||
|
||
### disabled: boolean | ||
|
||
Disables all `Focus` events. | ||
|
||
### onBlur: (e: FocusEvent) => void | ||
|
||
Called when the element loses focus. | ||
|
||
### onFocus: (e: FocusEvent) => void | ||
|
||
Called when the element gains focus. | ||
|
||
### onFocusChange: boolean => void | ||
|
||
Called when the element changes hover state (i.e., after `onBlur` and | ||
`onFocus`). |
Empty file.
Oops, something went wrong.