Giter Club home page Giter Club logo

react-range-slider-input's Introduction

Wishlist now on Steam!

react-range-slider-input's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-range-slider-input's Issues

Incompatible with next js

Not compatible with next js as a global css is being imported

Error Message
error - ./node_modules/react-range-slider-input/dist/components/index.css Global CSS cannot be imported from within node_modules. Read more: https://nextjs.org/docs/messages/css-npm Location: node_modules/react-range-slider-input/dist/components/RangeSlider.js

More info: https://nextjs.org/docs/messages/css-npm

className="single-thumb" doesn't hide first thumb

import Slider from 'react-range-slider-input';
import 'react-range-slider-input/dist/style.css';
...
const [sliderVal, setSliderVal] = useState(5000);
...
<Slider
  className="single-thumb"
  max={10000}
  min={0}
  onInput={(value: number) => setSliderVal(value[1])}
  rangeSlideDisabled={true}
  step={100}
  thumbsDisabled={[true, false]}
  value={[0, sliderVal]}
/>

With the code above the first thumb is still displayed.
Image
Using v3.0.7.

Custom CSS Classes Support

The library currently supports a custom css class that goes along with range-slider in the root/wrapper element. This issue is more about allowing developer to completely replace all range-sliders classes with custom ones.

Motivation

Allowing developers to completely replaces the default css variables allows them to:

  • Support CSS Modules
  • Have more granular control
  • Avoid collisions (e.g. an app could already have a global range-slider class for something else)

Suggestion

Replace the className props with a classNames prop that accepts an object

type Props = {
   classNames?: {
      slider?: string,
      thumb?: string,
      range?: string,
   }
}

classNames should be optional as well as the keys, and default to the current classes.

Error thrown when resizing the window

When I resize the window I get an error

TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.

This error does not seem to affect the functionality in my use case, but the error is thrown for each resize event fired.

I assume this is coming from the code below, but I don't understand how window could be undefined when I'm manually resizing my browser window.

// thumb width & height values are to be synced with the CSS values for correct calculation of
// thumb position and range width & position
// Called when,
// -> setValue is called and a value is set (called before updateThumbs() and updateRange())
// -> thumb / range drag is initiated
// -> window is resized
syncThumbDimensions () {
this.iterateMinMaxProps(_ => {
this.thumbWidth[_] = float(window.getComputedStyle(this.thumb[this.index[_]].current).width)
this.thumbHeight[_] = float(window.getComputedStyle(this.thumb[this.index[_]].current).height)
})
}

chrome_0leDrxZjEX.webm

I'm using next.js and this error happens in development and production.

Controlled component moves weird when dragging whole range

Dragging a whole range with a react controlled value causes the slider to move with a different speed than the mouse cursor. It looks fine when you move the slider fast, but when moving it slowly the slider "fly away" from the cursor.

You can see the effect in the sandbox demo in the "Controlled" component by dragging the whole slider slowly or fast. It does not happen for "Default" nor if you only drag one end. However, it does appear like the "Default" might be self correcting itself...

Tested in Chrome and Safari on Mac.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.