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

Function scroll

packages/@react-spectrum/ai/src/AttachmentList.tsx:505–523  ·  view source on GitHub ↗
(dir: 1 | -1)

Source from the content-addressed store, hash-verified

503 otherProps.onAction || ctx?.onAction ? chain(otherProps.onAction, ctx?.onAction) : undefined;
504
505 let scroll = (dir: 1 | -1) => {
506 let el = scrollRef.current;
507 if (!el) {
508 return;
509 }
510
511 // RTL flips the scroll direction convention; flip the sign to match.
512 let sign = direction === 'rtl' ? -1 : 1;
513 el.scrollTo({
514 left: Math.max(
515 0,
516 Math.min(
517 el.scrollWidth - el.clientWidth,
518 el.scrollLeft + sign * dir * (el.clientWidth - 64 * 2)
519 )
520 ),
521 behavior: 'smooth'
522 });
523 };
524
525 return (
526 <TagGroup

Callers 1

AttachmentList.tsxFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected