MCPcopy Index your code
hub / github.com/adobe/react-spectrum / Example

Function Example

packages/react-aria/test/interactions/usePress.test.js:32–40  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

30import {usePress} from '../../src/interactions/usePress';
31
32function Example(props) {
33 let {elementType: ElementType = 'div', style, draggable, ...otherProps} = props;
34 let {pressProps} = usePress(otherProps);
35 return (
36 <ElementType {...pressProps} style={style} tabIndex="0" draggable={draggable} id="testElement">
37 {ElementType !== 'input' ? props.children || 'test' : undefined}
38 </ElementType>
39 );
40}
41
42function pointerEvent(type, opts) {
43 let evt = new Event(type, {bubbles: true, cancelable: true, composed: true});

Callers

nothing calls this directly

Calls 1

usePressFunction · 0.90

Tested by

no test coverage detected