UNPKG

downshift

Version:

🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.

13 lines (12 loc) 836 B
import * as React from 'react'; /** * Utility hook that scrolls an item from a menu into view. * @param scrollIntoView The function that does the scroll. * @param highlightedIndex The index of the item that should be scrolled. * @param isOpen If the menu is open or not. * @param menuRef The ref to the menu element. * @param itemsRef The ref to the object containing item elements. * @param getItemId The function to get the item id from index. * @returns Function that when called prevents the scroll. */ export declare function useScrollIntoView(scrollIntoView: (node: HTMLElement, menuNode: HTMLElement) => void, highlightedIndex: number, isOpen: boolean, menuRef: React.MutableRefObject<HTMLElement | null>, itemsRef: React.MutableRefObject<Record<string, HTMLElement>>, getItemId: (index: number) => string): () => void;