MCPcopy Create free account
hub / github.com/adobe/react-spectrum / Example

Function Example

packages/react-aria/test/overlays/usePopover.test.tsx:19–32  ·  view source on GitHub ↗
(props: OverlayTriggerProps)

Source from the content-addressed store, hash-verified

17import {usePopover} from '../../src/overlays/usePopover';
18
19function Example(props: OverlayTriggerProps) {
20 const triggerRef = useRef(null);
21 const popoverRef = useRef(null);
22 const state = useOverlayTriggerState(props);
23 useOverlayTrigger({type: 'listbox'}, state, triggerRef);
24 const {popoverProps} = usePopover({triggerRef, popoverRef}, state);
25
26 return (
27 <div>
28 <div ref={triggerRef} />
29 <div {...popoverProps} ref={popoverRef} />
30 </div>
31 );
32}
33
34describe('usePopover', () => {
35 it('should not close popover on scroll', () => {

Callers

nothing calls this directly

Calls 3

useOverlayTriggerStateFunction · 0.90
useOverlayTriggerFunction · 0.90
usePopoverFunction · 0.90

Tested by

no test coverage detected