react-native-drop-zone
Version:
React Native module for drag-n-drop function on iOS
72 lines (53 loc) • 1.97 kB
TypeScript
declare module "react-native-drop-zone" {
import { StyleProp, ViewStyle } from "react-native";
interface DropPointProps {
x: number;
y: number;
}
interface DropZoneEventProps {
position: DropPointProps;
files: string[];
texts: string[];
urls: string[];
}
/**
* Properties of the DropZone component
*/
interface DropZoneProps {
// Drop session has moved into the drop interaction's view
onDragEnter?: (dropPoint: DropPointProps) => void;
// Drop session(droppable items' location) has changed
onDragOver?: (dropPoint: DropPointProps) => void;
// Drop session has moved out of the drop interaction's view
onDragLeave?: () => void;
// Drop session has ended
onDragExit?: () => void;
// Start to request the item provider data from the session's drag items
onProcessingDrop?: (dropPoint: DropPointProps) => void;
// Session's drag items have been finished processed.
onDrop?: (event: DropZoneEventProps) => void;
// Text, URL, Image, Video, Audio, Other
allowedDataTypes?: string[];
// Style attributes for the view, as expected in a standard `View`
style?: StyleProp<ViewStyle>;
}
interface DragPointProps {
x: number;
y: number;
}
interface DragViewProps {
// The lift animation has finished and the user is starting to move the items across the screen.
onDragBegin?: () => void;
// The user starts to move the drag items
onDragOver?: (dropPoint: DragPointProps) => void;
// The drag activity and its related animations have finished.
onDragEnd?: () => void;
// Drag Preview Callback
dragPreview?: React.ReactNode;
// context of the drag items, it can be text, urls, or image-url.
context?: string[];
style?: StyleProp<ViewStyle>;
}
export class DropZone extends React.PureComponent<DropZoneProps, {}> {}
export class DragView extends React.PureComponent<DragViewProps, {}> {}
}