UNPKG

react-native-focal

Version:

Humble kit to professionally handle the focus/blur experience for controlled components.

62 lines (61 loc) 2.26 kB
/// <reference types="react" /> declare type TComponent = { node: any; onBlur: (node: any) => boolean; }; /** * Ref containing the list of all the nodes within all the providers. */ declare const focuses: import("react").RefObject<{ [key: string]: TComponent; } & { focused?: string | undefined; }>; /** * Method responsible for resetting the focal object ref to an empty object. */ declare const resetFocuses: () => void; /** * Gracefully `blur` the focused node via the `onBlur` method specified in the `Controller` props if it can be `blur`red. * @param force {boolean} flag to indicate whether to force removing the focused component logically or not. */ declare const blur: (force?: boolean | undefined) => void; /** * Method responsible for retrieving the focused component value within the ref. */ declare const getFocused: () => TComponent; /** * Method responsible for retrieving the focused component id within the ref. */ declare const getFocusedId: () => string | null; /** * Method responsible for retrieving the number of actual nodes in the focal object. */ declare const getLength: () => number; /** * Method responsible for retrieving a certain node within the focal object via index if valid. */ declare const getByIndex: (index: number) => unknown; /** * Ref containing the list of all the nodes within all the providers. */ declare const handlers: import("react").RefObject<{ [x: string]: import("react").Ref<unknown>; }>; /** * Method responsible for subscribing the handler within the handlers ref object. */ declare const subscribeHandler: (id: string, ref: any) => void; /** * Method responsible for unsubscribing the handler from the handlers ref object. */ declare const unsubscribeHandler: (id: string) => void; /** * Method responsible for resetting the focal object ref to an empty object. */ declare const resetHandlers: () => void; /** * Method responsible for retrieving the handlers list. */ declare const getHandlers: () => import("react").Ref<unknown>[]; export { focuses, blur, resetFocuses, getByIndex, getFocused, getFocusedId, getLength, handlers, subscribeHandler, unsubscribeHandler, resetHandlers, getHandlers };