Closed paulincai closed 2 years ago
ok, apparently I can get the currentTarget from onStart event (more correct actually on onFinish). However I believe the selector returned should be the one which this library binds to.
Hey @paulincai, the behavior you are describing are actually fully handled by React. bind
contains only handlers for standard react events like onMouseDown
and it passes received event untouched (with an exception of persisting it).
https://github.com/minwork/use-long-press/blob/7bda6f76d6cd842e8f82c4c67adfd1a3aea09798/src/index.ts#L245-L256
https://github.com/minwork/use-long-press/blob/7bda6f76d6cd842e8f82c4c67adfd1a3aea09798/src/index.ts#L152-L153
https://github.com/minwork/use-long-press/blob/7bda6f76d6cd842e8f82c4c67adfd1a3aea09798/src/index.ts#L166-L171
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Scenario: I want to long press on a React functional component with children. E.g in a list I have a contact with photo, name, status. I want to long press on the upper component that wraps the entire contact.
Presently the Event is bound to the clicked/touched selector (either photo, or name, or status). Technically this should be bound to the selector that the {...bind} is attached to.
e.target.id on long press on the next component should be 'x' e.currentTarget does not exist