UNPKG

react-native-draglist

Version:
32 lines (31 loc) 1.1 kB
import React from "react"; import { Animated } from "react-native"; export interface PosExtent { pos: number; extent: number; } export interface LayoutCache { [key: string]: PosExtent; } export interface ActiveData { key: string; index: number; } export interface HoverBus { index: number; subscribe: (cb: (hoverIndex: number) => void) => () => void; notify: (hoverIndex: number) => void; } export declare function createHoverBus(): HoverBus; declare type ContextProps<T> = { activeData: ActiveData | null; keyExtractor: (item: T, index: number) => string; pan: Animated.Value; hoverBus: HoverBus; layouts: LayoutCache; horizontal: boolean | null | undefined; children: React.ReactNode; }; export declare function DragListProvider<T>({ activeData, keyExtractor, pan, hoverBus, layouts, horizontal, children, }: ContextProps<T>): React.JSX.Element; export declare function useDragListContext<T>(): Pick<ContextProps<T>, "activeData" | "keyExtractor" | "pan" | "hoverBus" | "layouts" | "horizontal">; export {};