-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
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}
>
);
// 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);
}
}
}