UNPKG

react-native-tvfocus

Version:

React Native tvOS and Android TV library to improve focus management with multiple screens.

32 lines (31 loc) 1.11 kB
import React = require('react'); import Focusable from './focusable'; export default class FocusManager { readonly active = false; focusables: Map<number, Focusable<import("./focusable").FocusableProps>>; protected lastfocused: number | null; protected nextfocus: number | null; protected firstitem: number | null; protected defaultitem: number | null; forceUpdate: (() => void) | null; focus(focusable: Focusable | number): void; focusFirstIfNoDefault(): void; /** @internal */ shouldSetFocus(focusable: Focusable, isDefault: boolean): boolean; /** @internal */ handleRemovedFocusable(focusable: Focusable): void; /** @internal */ willBecomeActive(): void; /** @internal */ willBecomeInactive(): void; } export interface FocusManagerContextValue { focus: FocusManager; active: boolean; } export declare const defaultFocusContext: Readonly<{ focus: FocusManager; active: boolean; }>; export declare const FocusManagerContext: React.Context<FocusManagerContextValue>; export declare function useFocusManager(): FocusManager | null;