@lonli-lokli/scroll-restoration
Version:
A lightweight, framework-agnostic scroll restoration solution for React applications.
35 lines (34 loc) • 1 kB
TypeScript
import { Location, ScrollRestorationOptions } from './shapes';
/**
* Trigger scroll position saving
*/
export declare function saveCurrentScrollPositions(): void;
/**
* Trigger scroll position restoring
*/
export declare function restoreScrollPositions(): void;
/**
* Hook for scroll restoration in React applications
*/
export declare function useScrollRestoration(options?: ScrollRestorationOptions): void;
/**
* ScrollRestoration component
*/
export declare function ScrollRestoration(props: ScrollRestorationOptions): null;
/**
* Hook for element-specific scroll restoration
*/
export declare function useElementScrollRestoration(options: ({
id: string;
getElement?: () => Element | undefined | null;
} | {
id?: string;
getElement: () => Element | undefined | null;
}) & {
getKey?: (location: Location) => string;
getCurrentLocation?: () => Location;
}): {
scrollX: number;
scrollY: number;
} | undefined;
//# sourceMappingURL=scroll-restoration.d.ts.map