Skip to content

Event propagation is stopped by useLongPress on Android(chrome) but not on iOS(safari) #50

@kofoednielsen

Description

@kofoednielsen

Hello,

I'm experiencing difference in behavior of use-long-press between android and iOS.

On iOS if i long press my button in this example, i trigger both "clicked" and "long pressed", but on android i trigger only "long pressed" which is what i want.

import * as React from "react";
import { useLongPress } from "use-long-press";

export default function App() {
  const handlers = useLongPress(() => alert("long pressed"));
  return (
    <button
      style={{ height: "200px", width: "200px", WebkitUserSelect: "none" }}
      {...handlers()}
      onClick={() => alert("clicked")}
    >
      test
    </button>
  );
}

Here is the sandbox i used to reproduce

https://codesandbox.io/p/sandbox/uselongpress-v3-forked-srr3gq

And here is the sandbox preview

https://srr3gq.csb.app/

Metadata

Metadata

Assignees

Labels

platformsDiscrepancies between different platformsuse-long-pressuse-long-press hook related issues

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions