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

Function useResize

packages/react-aria/src/overlays/useOverlayPosition.ts:425–432  ·  view source on GitHub ↗
(onResize)

Source from the content-addressed store, hash-verified

423}
424
425function useResize(onResize) {
426 useLayoutEffect(() => {
427 window.addEventListener('resize', onResize, false);
428 return () => {
429 window.removeEventListener('resize', onResize, false);
430 };
431 }, [onResize]);
432}
433
434function translateRTL(position, direction) {
435 if (direction === 'rtl') {

Callers 1

useOverlayPositionFunction · 0.85

Calls 2

addEventListenerMethod · 0.80
removeEventListenerMethod · 0.80

Tested by

no test coverage detected