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

Function scrollToRest

packages/react-aria-components/src/Sheet.tsx:372–378  ·  view source on GitHub ↗
(smooth: boolean)

Source from the content-addressed store, hash-verified

370 // Open at the first custom detent when provided, otherwise the fully-entered position.
371 let initial = element.querySelector<HTMLElement>('[data-sheet-initial]');
372 let scrollToRest = (smooth: boolean) => {
373 if (initial) {
374 scrollDetentIntoView(scroller, initial, axis, after ? 'start' : 'end', smooth);
375 } else {
376 scrollAlongAxis(scroller, axis, (enteredScroll / 100) * vp, smooth);
377 }
378 };
379 if (enteredScroll === 0) {
380 // The rest position is at scroll 0, so the sheet mounts already entered. Jump to the exit
381 // first, then animate back in on the next frame — doing both in the same task can leave

Callers 1

Sheet.tsxFile · 0.85

Calls 2

scrollDetentIntoViewFunction · 0.85
scrollAlongAxisFunction · 0.85

Tested by

no test coverage detected