react-scroll-to
Version:
Scroll to a position using react
37 lines (36 loc) • 1.06 kB
TypeScript
import * as React from "react";
interface IContextProps {
addScrollArea(id: string, node: unknown): any;
removeScrollArea(id: string): any;
}
export declare const ScrollToContext: React.Context<IContextProps>;
interface IScrollOptions {
id?: string;
ref?: React.RefObject<unknown>;
x?: number;
y?: number;
smooth?: boolean;
}
interface IProps {
children?: (props: {
scroll: (props?: IScrollOptions) => void;
}) => React.ReactNode;
}
/**
* Component that uses render props to inject
* a function that allows the consumer to scroll to a
* position in the window or ScrollArea component
*/
declare class ScrollTo extends React.Component<IProps> {
scrollArea: {
[key: string]: React.ReactNode;
};
getContext: IContextProps;
constructor(props: any);
addScrollArea: (id: any, ref: any) => void;
removeScrollArea: (id: any) => void;
handleScroll: (props?: IScrollOptions) => void;
_scrollNode: (node: any, options: any) => void;
render(): JSX.Element;
}
export default ScrollTo;