Drag events do not get handled by <Slider> trayProps
See original GitHub issuepure-react-carousel
version: masterreact
version: v16.8.6browser
used: Chrome v 78.0.3904.108node
version: v8.11.1
Relevant code or config:
function eventLogger(ev) {
console.log(ev.type, ev.target);
}
return (
<CarouselProvider ... dragEnabled={true}>
<Slider trayProps={{
onDrag: eventLogger,
onDragEnd: eventLogger,
onDragEnter: eventLogger,
onDragExit: eventLogger,
onDragLeave: eventLogger,
onDragOver: eventLogger,
onDragStart: eventLogger
}}>
<Slide>...</Slide>
<Slide>...</Slide>
<Slide>...</Slide>
</Slider>
</CarouselProvider>
)
What you did:
Applied drag events on slides.
What happened:
Nothing is reported by the eventLogger
function.
Reproduction:
See https://github.com/express-labs/pure-react-carousel/blob/fe25e75227b17101ae13a23e6421fbad6d36fe0b/src/App/examples/Example11/Example11.jsx for reproducible code.
Problem description:
I would like to track drag events on slides, in order to get the current selected slide (which is used as state elsewhere in the web app).
Currently, I am only able to use the button onClick
handlers to modify a “current-slide” state property.
Suggested solution:
Enable drag events.
Can you help us fix this issue by submitting a pull request?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Drag events not triggered - Stack Overflow
Angular provides APIs to bind directly to events generated by HTML elements. Better use these APIs so that you don't have to worry...
Read more >Elon Musk's SpaceX Sponsors 'All-Ages' Drag Event
Controversy surrounded this event as soon as it was announced. People immediately noticed the event's sponsorship by SpaceX, causing Elon Musk's ...
Read more >Issue with React state update during drag event - GreenSock
When the current slide update the animation (or drag) stops. I can't find a way around this and I'm not sure why it's...
Read more >Differentiate between a Click and Swipe/Drag event in React
Suppose we have a basic carousel header component where the user ... In other words, we don't want a on-click event to occur...
Read more >Drag | Testing Library
This example only works with a real browser (not with jsdom, as it does not support getBoundingClientRect ). Usage. await drag(slider, {
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Are there any workarounds?
I’ve moved on to other work, but I’ll close this up for the time being.