UNPKG

1.23 kBTypeScriptView Raw
1import type { DependencyList, ReanimatedEvent } from './commonTypes';
2interface GeneralHandler<Event extends object, Context extends Record<string, unknown>> {
3 (event: ReanimatedEvent<Event>, context: Context): void;
4}
5type GeneralHandlers<Event extends object, Context extends Record<string, unknown>> = Record<string, GeneralHandler<Event, Context> | undefined>;
6export interface UseHandlerContext<Context extends Record<string, unknown>> {
7 context: Context;
8 doDependenciesDiffer: boolean;
9 useWeb: boolean;
10}
11/**
12 * Lets you find out whether the event handler dependencies have changed.
13 *
14 * @param handlers - An object of event handlers.
15 * @param dependencies - An optional array of dependencies.
16 * @returns An object containing a boolean indicating whether the dependencies
17 * have changed, and a boolean indicating whether the code is running on the
18 * web.
19 * @see https://docs.swmansion.com/react-native-reanimated/docs/advanced/useHandler
20 */
21export declare function useHandler<Event extends object, Context extends Record<string, unknown>>(handlers: GeneralHandlers<Event, Context>, dependencies?: DependencyList): UseHandlerContext<Context>;
22export {};
23//# sourceMappingURL=useHandler.d.ts.map
\No newline at end of file