# react-native-drag-n-drop

> React native wrapper to the iOS 11 Drag and Drop API

Latest version **1.0.0** (published 2017-09-29) · 0 weekly downloads

## Install

```sh
npm install react-native-drag-n-drop
pnpm add react-native-drag-n-drop
yarn add react-native-drag-n-drop
bun add react-native-drag-n-drop
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-09-29 |
| First published | 2017-09-29 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Javier Alvarez |
| Maintainers | neiker |
| Keywords | react-native |

## Links

- npm: https://www.npmjs.com/package/react-native-drag-n-drop
- npm.io page: https://npm.io/package/react-native-drag-n-drop

## Recent versions

- 1.0.0 (latest) — 2017-09-29

## README

# react-native-drag-n-drop

You can see it in action on the [mural iOS app](https://itunes.apple.com/us/app/mural-visual-collaboration/id1156631145?mt=8) and on this video:

<a href="http://embed.vidyard.com/share/1uf7n97aPdiXhyVc9HSW9r" target="_blank">
    <img src="https://user-images.githubusercontent.com/688444/30982926-3c9313b2-a45f-11e7-9247-dc12601a78c3.png" width="400" />
</a>

## Getting started

`$ npm install react-native-drag-n-drop --save`

### Mostly automatic installation

`$ react-native link react-native-drag-n-drop`

### Manual installation


#### iOS

1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
2. Go to `node_modules` ➜ `react-native-drag-n-drop` and add `RNDragNDrop.xcodeproj`
3. In XCode, in the project navigator, select your project. Add `libRNDragNDrop.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
4. Run your project (`Cmd+R`)<


## Usage

You need to wrap the section of your app you like to be able to receibe drops with the DropTarget component. 

```javascript
import { DropTarget } from 'react-native-drag-n-drop';

function dropHandler(event) {
  console.log(event.nativeEvent.dropPoint);
  console.log(event.nativeEvent.files);
  console.log(event.nativeEvent.text);
  console.log(event.nativeEvent.url);
}

const dropTargetStyle = {
  width: 400,
  height: 400,
};

<DropTarget onDrop={dropHandler} style={dropTargetStyle}>
  // your content here
</DropTarget>
```
  

## TODO

- Implement drag source to move elements inside the app and export them.

---
_Source: https://npm.io/package/react-native-drag-n-drop · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
