Support for the iOS 11+ drag and drop API in React Native.
npm install react-native-ios-drag-dropreact-native-ios-drag-dropyarn add react-native-ios-drag-drop or npm install react-native-ios-drag-drop --savereact-native link react-native-ios-drag-dropLibraries ➜ Add Files to [your project's name]node_modules ➜ react-native-ios-drag-drop and add MOReactNativeIosDragDrop.xcodeprojlibMOReactNativeIosDragDrop.a to your project's Build Phases ➜ Link Binary With LibrariesCmd+R)<DragViewDragView allows you to make one of your React views draggable. A DragView has the same behaviour as a View except for it accepts a dragItem or dragItems prop (it must have _exactly_ one of these props).When used on an iOS 11+ iPad it will allow the user to long press on the view and drag it to a location which supports dropping (even across apps when used in multitasking mode).
You can provide one drag item (dragItem) or multiple drag items (dragItems) and even customise the preview with any React view you like.
!React Native iOS Drag Drop Single Item
``jsx
import { DragView } from 'react-native-ios-drag-drop';
export default function() {
return (
);
}
`
With a multiple drag items:
!React Native iOS Drag Drop Multiple Items
`jsx
import { DragView } from 'react-native-ios-drag-drop';
export default function() {
return (
);
}
`
With a URL drag items:
!React Native iOS Drag Drop URL
`jsx
import { DragView } from 'react-native-ios-drag-drop';
export default function() {
return (
);
}
`
With a custom preview view:
!React Native iOS Drag Drop Custom Preview
`jsx
import { DragView } from 'react-native-ios-drag-drop';
export default function() {
return (
);
}
`
You can use the example project to develop on. It is linked correctly to the code in src. When published the project is compiled using babel into lib along with the flow types.
- [X] Draggable
- [X] Custom dragItem
- [X] Multiple dragItems on a single component
- [X] Custom preview
- [ ] DropView`