fix incorrect react-dnd backend

This commit is contained in:
dannyrb committed 2020-06-03 15:08:19 -04:00
1 parent 70c39b9ad4
commit 74edfb0913
2 files changed
+5 -17

No files matched your search

@@ -4,6 +4,7 @@ import { DndProvider } from 'react-dnd';
import HTML5Backend from 'react-dnd-html5-backend';
import TouchBackend from 'react-dnd-touch-backend';
// TODO: this is false when it should not be :thinking:
const isTouchDevice =
typeof window !== `undefined` &&
!!('ontouchstart' in window || navigator.maxTouchPoints);
@@ -17,8 +18,10 @@ const isTouchDevice =
* http://react-dnd.github.io/react-dnd/docs/api/drag-drop-context
*/
function DragAndDropProvider({ children }) {
const backend = isTouchDevice ? TouchBackend : HTML5Backend;
const opts = isTouchDevice ? { enableMouseEvents: true } : {};
const backend = HTML5Backend; // isTouchDevice ? TouchBackend : HTML5Backend;
const opts = {}; // isTouchDevice ? { enableMouseEvents: true } : {};
console.log('using... touch backend?', isTouchDevice);
return (
<DndProvider backend={backend} opts={opts}>