expo-drag-drop-content-view
v0.9.2
Published
A Superset of View which listens for dragged contents
Maintainers
Readme
expo-drag-drop-content-view
A Superset of View which listens for dragged contents
API documentation
Installation in managed Expo projects
For managed Expo projects, please follow the installation instructions in the API documentation for the latest stable release. If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release.
Installation in bare React Native projects
For bare React Native projects, you must ensure that you have installed and configured the expo package before continuing.
Add the package to your npm dependencies
yarn add expo-drag-drop-content-viewConfigure for iOS
Run npx pod-install after installing the npm package.
Web blob URI cleanup
On web, dropped file assets carry a blob URI (asset.uri) created with URL.createObjectURL. Blob URIs hold memory until explicitly revoked — the recommended way to handle this is the useDropAssets hook, which revokes all URIs automatically on unmount and exposes a clear() method for manual flushing:
import { DragDropContentView, useDropAssets } from "expo-drag-drop-content-view";
export function DropZone() {
const { assets, onDrop, clear } = useDropAssets();
return (
<>
<DragDropContentView onDrop={onDrop} />
<button onClick={clear}>Clear</button>
</>
);
}If you manage assets yourself, call asset.release?.() when you're done with each one:
onDrop({ assets }) {
// use assets ...
assets.forEach((a) => a.release?.());
}Contributing
Contributions are very welcome! Please refer to guidelines described in the contributing guide.
