Skip to content

Drag working only once on mobile #726

@jmart6784

Description

@jmart6784

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions