question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Drag events do not get handled by <Slider> trayProps

See original GitHub issue
  • pure-react-carousel version: master
  • react version: v16.8.6
  • browser used: Chrome v 78.0.3904.108
  • node 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:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
vsolanogocommented, Dec 24, 2019

Are there any workarounds?

0reactions
alexpreynoldscommented, Dec 15, 2021

I’ve moved on to other work, but I’ll close this up for the time being.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found