MCPcopy
hub / github.com/adobe/react-spectrum / Example

Function Example

packages/react-aria/test/overlays/useModalOverlay.test.js:12–23  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

10import {useOverlayTriggerState} from 'react-stately/useOverlayTriggerState';
11
12function Example(props) {
13 let ref = useRef();
14 let state = useOverlayTriggerState(props);
15 let {modalProps, underlayProps} = useModalOverlay(props, state, ref);
16 return (
17 <div {...mergeProps(underlayProps, props.underlayProps || {})}>
18 <div ref={ref} {...modalProps} data-testid={props['data-testid'] || 'test'}>
19 {props.children}
20 </div>
21 </div>
22 );
23}
24
25describe('useModalOverlay', function () {
26 describe.each`

Callers

nothing calls this directly

Calls 3

useOverlayTriggerStateFunction · 0.90
useModalOverlayFunction · 0.90
mergePropsFunction · 0.90

Tested by

no test coverage detected