Touch Backend for react-dnd
This is a fork of the Touch Backend, which has been adapted for mouse functionality. Its main purpose is to provide an alternative to the HTML5 Backend, for applications which need to circumvent the limitations of HTML5 drag and drop in Edge and IE browsers.
NOTE: The original touch functionality has not been tested and is therefore quite possibly broken.*
Follow react-dnd docs to setup your app. Then swap out HTML5Backend
for TouchBackend
as such:
import { default as TouchBackend } from 'react-dnd-touch-backend';
import { DragDropContext } from 'react-dnd';
var YourApp = React.createClass(
/* ... */
);
module.exports = DragDropContext(
TouchBackend({ enableMouseEvents: true, enableTouchEvents: false })
)(YourApp);
Since native Drag-n-Drop is not currently supported in touch devices. A custom DragPreview is required. Check out the example for a sample implementation.
We might try to build it directly in the Backend itself in the future to compensate for this limitation.
The examples
folder has a sample integration. In order to build it, run:
npm i && gulp js-dev
Then, open examples/index.html
in a mobile browser.
Code licensed under the MIT license. See LICENSE file for terms.