react-native-multi-slider icon indicating copy to clipboard operation
react-native-multi-slider copied to clipboard

How to set the value during the sliding process

Open shenshenwlb opened this issue 7 years ago • 5 comments

How to set the value during the sliding process, so that the marker can have custom scrolling logic

shenshenwlb avatar Nov 01 '18 09:11 shenshenwlb

That is not possible as of today since passing new props is blocked when the markers are actively being updated. https://github.com/ptomasroos/react-native-multi-slider/blob/master/MultiSlider.js#L98

What type of logic where you considering @shenshenwlb ?

ptomasroos avatar Nov 01 '18 09:11 ptomasroos

@ptomasroos hi! I faced the same issue. I'm trying to implement a "magnetic" slider with some maximum possible difference between min and max values. And when the actual diff is bigger than maximum, I want to change the second marker value as well. Maybe there are some workarounds?

kuzkokov avatar Mar 01 '19 13:03 kuzkokov

I have the same request. Say a slider with a max range of 30 with a buffer of 3 to the min and max. Total possible range is 36 but the max allowable selected distance is 30.

  • When Marker1 = 0, then Marker2 should stop at 30 (not 36).
  • When Marker1 = 3, then Marker2 should stop at 33 (not 36).

Right now, I can stop override the values, but the slider markers do not update the position when dragging is finished.

I guess this would be a maxMarkerOverlapDistance and work similar to your existing minMarkerOverlapDistance

cnickless avatar Mar 18 '20 03:03 cnickless

Today this is not possible @cnickless Can you explain to me the use-case for having a "buffer" on each side? Is it a design purpose or something else?

ptomasroos avatar Mar 18 '20 06:03 ptomasroos

I have same problem if I change Marker1 I want to change also Marker2, I'm getting updated value with state but Marker2 position doesn't change, what should I do?

peter1a avatar Jul 09 '20 06:07 peter1a