UNPKG

@lucarestagno/use-scroll-into-view

Version:

React Hook to scroll an element into the view

24 lines (23 loc) 700 B
export declare enum ScrollIntoViewBehavior { auto = "auto", smooth = "smooth" } export declare enum ScrollIntoViewBlock { start = "start", center = "center", end = "end", nearest = "nearest" } export declare enum ScrollIntoViewInline { start = "start", center = "center", end = "end", nearest = "nearest" } export declare type ScrollIntoViewOptions = { behavior?: keyof typeof ScrollIntoViewBehavior; block?: keyof typeof ScrollIntoViewBlock; inline?: keyof typeof ScrollIntoViewInline; }; declare const useScrollIntoView: (ref: React.RefObject<any>, isSomething: boolean, config?: ScrollIntoViewOptions) => void; export default useScrollIntoView;