UNPKG

react-native-event

Version:

React context for subscribing to all react native interaction events

15 lines (14 loc) 701 B
import type { ReactNode } from 'react'; import type { GestureResponderEvent } from 'react-native'; export type EventTypes = GestureResponderEvent; export type HandlerType = (event: EventTypes) => void; export type EventContextType = { subscribe: (handler: HandlerType) => void; }; export declare const EventContext: import("react").Context<EventContextType>; export type EventProviderProps = { events?: string[]; children?: ReactNode; }; export declare function EventProvider({ children }: EventProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<EventContextType>>; export declare function useEvent(handler: HandlerType, dependencies: unknown[]): void;