1.0.0 • Published 8 years ago
react-native-drag-n-drop v1.0.0
react-native-drag-n-drop
You can see it in action on the mural iOS app and on this video:
Getting started
$ npm install react-native-drag-n-drop --save
Mostly automatic installation
$ react-native link react-native-drag-n-drop
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries➜Add Files to [your project's name] - Go to
node_modules➜react-native-drag-n-dropand addRNDragNDrop.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNDragNDrop.ato your project'sBuild Phases➜Link Binary With Libraries - 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.
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.