UNPKG

rc-scroll-into-view

Version:

Solving the issue of scrollIntoView failing during asynchronous scrolling in JavaScript.

15 lines (14 loc) 654 B
import type { MutableRefObject } from "react"; import { HTMLAttributes, FC } from "react"; type TargetType = HTMLElement | Element | Window | Document; type TargetValue<T> = T | undefined | null; export type BasicTarget<T extends TargetType = Element> = TargetValue<T> | MutableRefObject<TargetValue<T>>; export interface ScrollIntoViewProps extends HTMLAttributes<HTMLElement> { selector?: string; scrollOptions?: ScrollIntoViewOptions; isScrollable?: boolean; scrollRef?: MutableRefObject<HTMLElement | null>; target?: BasicTarget<Element | Document>; } declare const ScrollInto: FC<ScrollIntoViewProps>; export default ScrollInto;