Skip to content

Commit 8a51de9

Browse files
committed
fix(touch): Fix window scrolling while dragging on iDevices. Fixes #183
Also fixes react-grid-layout/react-grid-layout#338
1 parent 9d3bbf9 commit 8a51de9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/DraggableCore.es6

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ export default class DraggableCore extends React.Component {
253253

254254
handleDrag: EventHandler<MouseTouchEvent> = (e) => {
255255

256+
// Prevent scrolling on mobile devices, like ipad/iphone.
257+
if (e.type === 'touchmove') e.preventDefault();
258+
256259
// Get the current drag point from the event. This is used as the offset.
257260
const position = getControlPosition(e, this.state.touchIdentifier, this);
258261
if (position == null) return;

0 commit comments

Comments
 (0)