Closed kamzata closed 2 years ago
That's a really good use case that's need to be handled internally. I will work on implementing that, but for the time being you can make a workaround and append preset
to event
data passed to onMouseUp
onMouseLeave
and onTouchEnd
in order to extract it in onCancel
(note that you need to set option captureEvent
to true
) like this:
onMouseUp={(event) => {
// Not sure it will actually work that way, but worth a try
event.preset = preset;
return bind.onMouseUp(event);
}}
onMouseLeave={...}
onTouchEnd={...}
and then in onCancel
onCancel: (event) {
const preset = event.preset;
}
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.
@kamzata Addressed in #23
I have some code like this. I'd like to intercept the single click and tap, and the long click e long press .
So, I thought to remove
onClick={() => start(preset)}
from the button and callstart(preset)
fromshortPress
function. But how can I pass thepreset
argument as well?Basically, I'd need to pass an argument to
onCancel
callback from{...bind}
. Is there a way to do it?