fix: Address issues with touch devices and drag/drop causing crashes (#982)

This commit is contained in:
Erik Ziegler authored and GitHub committed 2019-10-01 09:00:55 +02:00
1 parent d596ab5c3d
commit cf40a8388c
1 file changed
+3 -2
@@ -10,10 +10,11 @@ const isTouchDevice = !!('ontouchstart' in window || navigator.maxTouchPoints);
//
// http://react-dnd.github.io/react-dnd/docs/api/drag-drop-context
export default function viewerbaseDragDropContext(DecoratedClass) {
const backend = isTouchDevice ? TouchBackend({ enableMouseEvents: true }) : HTML5Backend;
const backend = isTouchDevice ? TouchBackend : HTML5Backend;
const opts = isTouchDevice ? { enableMouseEvents: true } : {};
return (props) => (
<DndProvider backend={backend}>
<DndProvider backend={backend} opts={opts}>
<DecoratedClass {...props}/>
</DndProvider>
);