Skip to content
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

[Question & Request] Get event ondragEnter and OnDragEnd #129

Open
c0ncentus opened this issue Mar 9, 2021 · 3 comments
Open

[Question & Request] Get event ondragEnter and OnDragEnd #129

c0ncentus opened this issue Mar 9, 2021 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@c0ncentus
Copy link

Hi,

I want make that https://codepen.io/c0ncentus/pen/LYRKdpL
so the simplest way to customize it is with your component (thanks) .... Wait .... can you detect (event) when user dragEnter and leave the drag ?

I have wrapp with div tag and that is not work : /
Currently support or not ?

Thanks to make React better 🤟

@gorhawk
Copy link

gorhawk commented Mar 21, 2021

If I understand this ticket correctly, this is something that I also wondered. I'm using this library with react-player, which is a player that is constantly updating its progress. So what I would need to do is detect when we are seeking, so I can stop updating my react-range instance. This could probably work by exposing this: isDragged: this.state.draggedThumbIndex > -1 with the help of an event for example: onDragStart and onDragEnd (which is probably = onFinalChange, that is already available)

@tajo
Copy link
Owner

tajo commented Mar 24, 2021

onDragStart and onDragEnd (which is probably = onFinalChange

right, onDragStart could be added, you might be also able to just use onChange to detect when user starts moving the thumb

@gorhawk
Copy link

gorhawk commented Mar 29, 2021

Example for posterity:

import * as React from 'react';
import { Range } from 'react-range';

class SuperSimple extends React.Component {
  state = { values: [50], isDragging: false };
  render() {
    return (
      <Range
        step={0.1}
        min={0}
        max={100}
        values={this.state.values}
        onChange={(values) => {this.setState({ values, isDragging: true })}
        onFinalChange={(values) => this.setState({ isDragging: false })}
        // ...
      />
    );
  }
}

@tajo tajo added enhancement New feature or request good first issue Good for newcomers labels Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants