UNPKG

react-native-focal

Version:

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

22 lines (21 loc) 898 B
/// <reference types="react" /> import { ViewProps } from 'react-native'; declare type TControllerProps<C> = { /** * Prop responsible to categorize the controlled component as a focusable one or not. Focusable component as `TextInput`, non focusable component as `Button`. */ isFocusable?: boolean; /** * Prop responsible for a customized handling of the `onBlur` action, expects a `boolean` as a return. `true` to remove the focus, `false` to keep in focus. */ onBlur?: (node: C) => boolean; /** * Prop responsible for a customized handling of the `onFocus` action. */ onFocus?: (node?: C) => void; }; declare type TProps<C> = ViewProps & TControllerProps<C> & { children: any; }; declare function Controller<C>({ children, isFocusable, onBlur, onFocus, ...props }: TProps<C>): JSX.Element; export default Controller;