-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TS] <DraggableCore>'s event handlers are not using React events, but the typing said so #373
Comments
What's the actual error? |
@be5invis |
It is a |
I am using Some code: function handleDrag(e: React.MouseEvent<HTMLElement> | React.TouchEvent<HTMLElement>, d: DraggableData) {
e.persist();
somethingElse(e.nativeEvent);
}
<DraggableCore
onDrag={handleDrag}
>
<div>
test
</div>
</DraggableCore> |
Ah, I see now why this happens: https://github.com/mzabriskie/react-draggable/blob/master/lib/DraggableCore.js#L297 This is not a React-wrapped event. Brainstorming how to address it. |
@STRML |
DraggableEventHandler
' s first parameter is not React event
Since |
I don't see any good way to arbitrarily wrap a native event in a export type DraggableEventHandler = (
e: React.MouseEvent<HTMLElement> | React.TouchEvent<HTMLElement> | MouseEvent | TouchEvent,
data: DraggableData
) => void | false; Please try it out and open a PR if it works for you. |
@STRML LGTM export type DraggableEventHandler = (
e: React.MouseEvent<HTMLElement | SVGElement> | React.TouchEvent<HTMLElement | SVGElement> | MouseEvent | TouchEvent,
data: DraggableData
) => void | false; |
Fixed in #374 |
should be
The text was updated successfully, but these errors were encountered: