import { TextInput, TouchableHighlight, TouchableOpacity, View } from 'react-native'; type Callback = (...args: T) => void; type EventEmitter = { on: (eventName: string, callback: Callback) => void; off: (eventName: string, callback?: Callback) => void; emit: (eventName: string, ...args: T) => void; }; type Direction = 'up' | 'down' | 'left' | 'right'; type ORDER$1 = { HORIZONTAL: 'horizontal'; VERTICAL: 'vertical'; GRID: 'grid'; }; type FocusableWithKind = { id: string | null | undefined; kind: 'group' | 'element'; }; type FocusableByDirection = { [key in Direction]?: string | FocusableWithKind | null; }; type ElementByDirection = { [key in Direction]?: string | null; }; type EventResult = { current: T | undefined | null; direction: Direction | undefined | null; }; type FocusEventResult = EventResult & { prev: T | undefined | null; }; type BlurEventResult = EventResult & { next: T | undefined | null; }; type Focusable = { id: string; /** * @deprecated * For test purposes only. */ _ref?: HTMLElement; }; type FocusableElement = Focusable & { instance?: TextInput | TouchableHighlight | TouchableOpacity; group: string; /** * If group is setted byOrder, the order will be used to find the next element. * nextByDirection will be overrided by this property. */ order?: number; nextByDirection?: FocusableByDirection; onFocus?: (result: FocusEventResult) => void; onBlur?: (result: BlurEventResult) => void; }; type FocusableElementOptions = Omit; type FocusableGroup = Focusable & { elements: Set; }; type FocusableGroupConfig = Focusable & { instance?: View; firstElement?: string; lastElement?: string; nextGroupByDirection?: ElementByDirection; byOrder?: ORDER$1[keyof ORDER$1]; cols?: number | Record; saveLast?: boolean; viewportSafe?: boolean; threshold?: number; onFocus?: (result: FocusEventResult) => void; onBlur?: (result: BlurEventResult) => void; keepFocus?: boolean; arrowDebounce?: boolean; }; type FocusableGroupOptions = Omit; type Rect = { x: number; y: number; width: number; height: number; left: number; top: number; right: number; bottom: number; }; type FocusNodeOptions = { preventScroll?: boolean; }; type Adapter = { type: 'web' | 'react-native'; getNodeRect: (focusable: FocusableElement | FocusableGroupConfig) => Rect; isNodeDisabled: (focusable: FocusableElement) => boolean; focusNode: (focusable: FocusableElement, opts?: FocusNodeOptions) => void; isNodeFocusable: (focusable: FocusableElement) => boolean; getNodeRef: (focusable: Focusable) => unknown; getFocusedNode: () => unknown; }; type ArrowNavigationState = { currentElement: string | null; groupsConfig: Map; groups: Map; elements: Map; debug?: boolean; readonly adapter: Adapter; initialFocusElement?: string; readonly registerCooldown?: number; }; type ArrowNavigationOptions = { debug?: boolean; errorOnReinit?: boolean; preventScroll?: boolean; adapter?: Adapter; disableWebListeners?: boolean; initialFocusElement?: string; registerCooldown?: number; }; type GetNextOptions = { direction: Direction; elementId?: string; }; type GetNextGroupOptions = GetNextOptions; type GetNextElementOptions = GetNextOptions & { inGroup?: boolean; }; type ArrowNavigationInstance = { getFocusedElement: () => FocusableElement | null; setFocusElement: (id: string) => void; setInitialFocusElement: (id: string) => void; registerGroup: (id: string, options?: FocusableGroupOptions) => void; updateGroup: (id: string, options: Omit) => void; registerElement: (id: string, groupId: string, options?: FocusableElementOptions) => void; updateElement: (id: string, options: FocusableElementOptions) => void; unregisterElement: (id: string) => void; resetGroupState: (id: string) => void; destroy: () => void; getCurrentGroups: () => Set; getGroupElements: (group: string) => Set; getGroupConfig: (group: string) => FocusableGroupConfig | undefined; getRegisteredElements: () => Set; getFocusedGroup: () => string | undefined; getNextElement: (opts: GetNextElementOptions) => string | null; getNextGroup: (opts: GetNextGroupOptions) => string | null; handleDirectionPress: (direction: Direction, repeat: boolean) => void; on: EventEmitter['on']; off: EventEmitter['off']; /** * @deprecated * @returns The current state of the arrow navigation instance. * This is a helper function to test arrow navigation. It is not part of the public API. */ _getState: () => ArrowNavigationState | null; /** * This is a helper function to test arrow navigation. It is not part of the public API. * @deprecated */ _setState: (state: ArrowNavigationState) => void; /** * This is a helper function to test arrow navigation. It is not part of the public API. * @deprecated */ _forceNavigate: (key: string) => void; }; declare global { interface Window { arrowNavigation: { init: (options?: ArrowNavigationOptions) => void; get(): ArrowNavigationInstance; }; } } declare function initArrowNavigation({ errorOnReinit, debug, preventScroll, disableWebListeners, adapter, initialFocusElement, registerCooldown }?: ArrowNavigationOptions): ArrowNavigationInstance; declare function getArrowNavigation(): ArrowNavigationInstance; declare function getElementIdByOrder(groupId: string, idx: number): string; declare const webAdapter: Adapter; declare const EVENTS: { CURRENT_ELEMENT_CHANGE: string; CURRENT_GROUP_CHANGE: string; ELEMENTS_CHANGED: string; GROUPS_CHANGED: string; GROUPS_CONFIG_CHANGED: string; GROUP_BLUR: string; GROUP_FOCUS: string; ELEMENT_FOCUS: string; ELEMENT_BLUR: string; ELEMENTS_REGISTER_END: string; }; declare const ORDER: ORDER$1; export { Adapter, EVENTS as ArrowNavigationEvents, ORDER as ArrowNavigationOrder, ArrowNavigationState, BlurEventResult, Direction, FocusEventResult, FocusNodeOptions, Focusable, FocusableByDirection, FocusableElement, FocusableElementOptions, FocusableGroup, FocusableGroupConfig, FocusableGroupOptions, FocusableWithKind, Rect, getArrowNavigation, getElementIdByOrder, initArrowNavigation, webAdapter };