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

This commit is contained in:
Erik Ziegler 2019-10-01 09:00:55 +02:00 committed by GitHub
parent d596ab5c3d
commit cf40a8388c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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>
);