react-draggable icon indicating copy to clipboard operation
react-draggable copied to clipboard

Drag working only once on mobile

Open jmart6784 opened this issue 2 years ago • 1 comments

Hello, I am experiencing an issue with a draggable component. When on mobile I can drag only once before I cannot drag anymore. If I exit Chrome dev tools mobile view, I can then continue to drag without issue. I have a very similar component that works as expected in both desktop and mobile views.

// Dragging element an element inside the deadzone will not trigger next or previous video const handleStop = (event, dragElement) => { if (dragElement.y >= 120 || dragElement.y <= -120) { dragElement.y > 0 ? props.previousVideo() : props.nextVideo(); } };

return ( <Draggable axis="y" position={{ x: 0, y: 0 }} onStop={handleStop} allowAnyClick={true} > <div key={postId} className="reddit-video-wrapper">[TRUNCATED CONTENT] </Draggable> );

// Below are the Prop functions from previous component above. The posts below come from an API request. The logic triggers correctly when on the desktop view. The mobile view works as well, but only once as the drag stops working without an error message.

const previousVideo = () => index > 0 ? setIndex(index - 1) : "";

const nextVideo = () => { if (index != posts['data']['children'].length && !requested) { if (index == posts['data']['children'].length - 1) { setRequested(true); more("page"); } else { setIndex(index + 1); } } }

jmart6784 avatar Jul 20 '23 07:07 jmart6784