Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drag working only once on mobile #726

Open
jmart6784 opened this issue Jul 20, 2023 · 1 comment
Open

Drag working only once on mobile #726

jmart6784 opened this issue Jul 20, 2023 · 1 comment

Comments

@jmart6784
Copy link

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}
>

[TRUNCATED CONTENT]


);

// 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);
}
}
}

@jiaxiangcheng
Copy link

Same issue on v4.4.6. The drag on mobile only works the first time, then you have to tap a lot of times fastly on the element and it may be dragged again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants