react-component / slider

React Slider
https://slider.react-component.now.sh/
MIT License
3.05k stars 775 forks source link

Received `false` for a non-boolean attribute `dragging`. #502

Open Bernabe-Felix opened 5 years ago

Bernabe-Felix commented 5 years ago

Handle is passing a boolean property to the generated div

screen shot 2018-11-28 at 1 01 33 pm

edplato commented 5 years ago

@Bernabe-Felix The problem is a boolean is being passed as the dragging prop, when it is asking for a string. A temporary fix that we found is to wrap Handle in a function that returns it with a modified dragging prop. Something like this can be incorporated into a component:

import Slider, { Handle } from 'rc-slider';

const HandleWrapper = props => {
  const { dragging, ...restProps } = props;

  return (
    <React.Fragment>
      <Handle dragging={dragging.toString()} {...restProps} />
    </React.Fragment>
  );
};

... a lot of code skipped ...

<Slider
  handle={HandleWrapper}
/>
kiran8910 commented 5 years ago

I'm getting similar error with version 8.7.0 for reverse attribute

image

twistezo commented 3 years ago

Take a look at line: const { dragging, ...restProps } = props;. props should be unwrapped instead of passing them directly like: <Handle dragging={props.dragging.toString()} {...props} />

In the other words, you can't skip const { dragging, ...restProps } = props;.

javierfuentesm commented 2 years ago

but now when you do that you get the following error , looks like the types are wrong and not expecting dragging , if i don't put it it works fine the types don't complain but on the console we get that error image