Slider: set Range value programmatically but cannot drag

Created on 13 Mar 2017  路  6Comments  路  Source: react-component/slider

I do <Range step={20} value={[this.state.selectedRange[0], this.state.selectedRange[1]]} />}

where selectedRange is [number, number], it worked well. But after that I just can't adjust the handler anymore, why?

I then tried to use defaultValue than value but the slider won't change on 2nd and onward call. Hmm..

question

All 6 comments

  • If you use value, which means you use controlled mode, you need use onChange
  • use defaultValue, it should be ok.

If you still have any problem, please provide a reproducible demo.

See: https://github.com/ant-design/ant-design/wiki/FAQ#i-set-the-value-of-inputselectetc-and-then-it-cannot-be-changed-by-users-action

@benjycui solved. Thanks!

But I have another problem. I place slider on top of another element. Is there any chance I can trigger the element behind it? I only want the handler to be draggable, not the rails. I try to set display none to the rails, it doesn't help.

Google pointer-event

@eldyvoon @paranoidjk
Controlled Slider is broken right now.
The reproducible demo ;)http://react-component.github.io/slider/examples/slider.html

Is the controlled Slider broken?

Was this page helpful?
0 / 5 - 0 ratings