@sendbird/uikit-react
Version:
Sendbird UIKit for React: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.
26 lines (25 loc) • 1.19 kB
TypeScript
export interface UseDragAndDropParams {
onAddFiles: (files: File[]) => void;
/** When true, listeners are not attached (e.g. mobile, channel disabled). */
disabled?: boolean;
/**
* Per-event filter. Return `false` to skip this drop entirely (no preventDefault,
* no onAddFiles). Default: accept every file drop. Used to coordinate multiple
* instances on the same page so each one only consumes drops in its own pane —
* e.g. main channel vs. thread.
*/
shouldAccept?: (event: DragEvent) => boolean;
}
/**
* Window-level drag-and-drop for file uploads. While enabled, the entire
* viewport accepts file drops — the caller does not need to render a visual
* affordance.
*
* When disabled, no listeners are attached, so the browser's default drop
* behavior (open the file) is preserved.
*
* When multiple instances are mounted concurrently (e.g. main channel composer
* + thread composer on desktop), each one passes a `shouldAccept` predicate so
* exactly one consumes any given drop based on its position in the DOM.
*/
export declare const useDragAndDrop: ({ onAddFiles, disabled, shouldAccept }: UseDragAndDropParams) => void;