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

minMarkerOverlapStepDistance doesn't work #238

Open
2 tasks done
FoxyGirl opened this issue Jul 16, 2021 · 2 comments
Open
2 tasks done

minMarkerOverlapStepDistance doesn't work #238

FoxyGirl opened this issue Jul 16, 2021 · 2 comments

Comments

@FoxyGirl
Copy link

Thank you a lot for your amazing multi-slider.
I use the latest multi slider version "@ptomasroos/react-native-multi-slider": "^2.2.2",
but unfortunately minMarkerOverlapStepDistance doesn't work

Steps to Reproduce

I have an example in Codesandbox

Expected Behavior

Multi slider has allowOverlap={false} and minMarkerOverlapStepDistance={40}.
Expected to have value which determines the closest two markers can come to each other (in steps, not pixels) equals 40 steps

Actual Behavior

But actually the markers overlap up to 1 step.

@Harsh2110mishra
Copy link

Harsh2110mishra commented Jul 21, 2021

Thank you a lot for your amazing multi-slider.
I use the latest multi slider version "@ptomasroos/react-native-multi-slider": "^2.2.2",
but unfortunately minMarkerOverlapStepDistance doesn't work

Steps to Reproduce

I have an example in Codesandbox

Expected Behavior

Multi slider has allowOverlap={false} and minMarkerOverlapStepDistance={40}.
Expected to have value which determines the closest two markers can come to each other (in steps, not pixels) equals 40 steps

Actual Behavior

But actually the markers overlap up to 1 step.

Hey, Can you please help me to take the values and setState of the first cursor and second cursor values? I am not able to take values in the class-based components.

Here is my code, Can you please help to solve this issue. I want to take the first cursor value and setState and then the same for the second one.

<MultiSlider
                            values={
                              ([this.state.rangeLow], [this.state.rangeHigh])
                            }
                            //isMarkersSeparated={true}
                            customMarker={CustomMarker}
                            onValuesChange={(values) => {
                              this.setState({
                                rangeLow: values,
                                rangeHigh: values,
                              });
                            }}
                            min={0}
                            max={500}
                            step={1}
                            snapped
                            showSteps={true}
                            trackStyle={{
                              height: 5,
                              borderRadius: 8,
                            }}
                            onToggleOne={(value) => {
                              this.setState({ rangeLow: value });
                            }}
                            onToggleTwo={(value) => {
                              this.setState({ rangeHigh: value });
                            }}
                          />

I am not able to take values separately and also only one cursor is showing

How can I do this thing?

@KrushnaNaghate
Copy link

KrushnaNaghate commented Aug 22, 2022

I tried a lot of things, AFTER 2 Hours I got a solution dear, onToggle is not working In my case so here is the code,
so just use onvaluefinish you get value in an array of two elements use them,
if you are not getting two cursor use values={[0,100]} ,

<MultiSlider
// ...
onValuesChangeFinish={value =>
this.setState({min: value[0],slidevalue:value[1]},()=>{console.log(value);})
}
min={0}
max={100}
// onToggleOne={value =>
// this.setState({min: value},()=>{console.log(this.state.min)})
// }
// onToggleTwo={value =>
// this.setState({slidevalue: value},()=>{console.log(this.state.slidevalue)})
// }
//onToggleOne={() => alert('check one')}
//onToggleTwo={() => alert('check two')}
//valuePrefix={'₹'}
values={[0,100]}
sliderLength={width / 1.5}
// enabledOne={true}
enableLabel={true}
enabledTwo={true}
isMarkersSeparated={true}
// imageBackgroundSource={truck}
markerOffsetX={0}
// markerOffsetY={100}
markerSize={{height: 20, width: 22}}
// customMarkerLeft={(e) => ({e.currentValue.toString()})} customMarkerRight={(e) => console.log(e)}
//minMarkerOverlapDistance={3}
/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants