-
Notifications
You must be signed in to change notification settings - Fork 46.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[react-events] Rename hook exports (#16533)
For example, 'useHoverResponder' becomes 'useHover'
- Loading branch information
Showing
24 changed files
with
259 additions
and
200 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# ContextMenu | ||
|
||
The `useContextMenu` hooks responds to context-menu events. | ||
|
||
```js | ||
// Example | ||
const Button = (props) => { | ||
const contextmenu = useContextMenu({ | ||
disabled, | ||
onContextMenu, | ||
preventDefault | ||
}); | ||
|
||
return ( | ||
<div listeners={contextmenu}> | ||
{props.children} | ||
</div> | ||
); | ||
}; | ||
``` | ||
|
||
## Types | ||
|
||
```js | ||
type ContextMenuEvent = { | ||
altKey: boolean, | ||
buttons: 0 | 1 | 2, | ||
ctrlKey: boolean, | ||
metaKey: boolean, | ||
pageX: number, | ||
pageY: number, | ||
pointerType: PointerType, | ||
shiftKey: boolean, | ||
target: Element, | ||
timeStamp: number, | ||
type: 'contextmenu', | ||
x: number, | ||
y: number, | ||
} | ||
``` | ||
|
||
## Props | ||
|
||
### disabled: boolean = false | ||
|
||
Disables the responder. | ||
|
||
### onContextMenu: (e: ContextMenuEvent) => void | ||
|
||
Called when the user performs a gesture to display a context menu. | ||
|
||
### preventDefault: boolean = true | ||
|
||
Prevents the native behavior (i.e., context menu). |
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
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
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
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
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
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
Oops, something went wrong.