githuboftigran / rn-range-slider

A native slider with range
MIT License
234 stars 130 forks source link

How to add distance in min and max values? #55

Closed kamlesh71 closed 2 years ago

kamlesh71 commented 4 years ago

I want to allow users to select the age range with minimum of 5 years.

shareef-dweikat commented 3 years ago

Can you elaborate? I don't get what you need exactly.

githuboftigran commented 3 years ago

As I understand, @kamlesh71 wants to allow to select a range "wider" than a predefined value. For example not allow ranges smaller than 3. [4, 9], [7, 11], [1, 5] are allowed, but [2, 3] is not allowed, because range size for first 3 are: 5, 4, 4 and range size of the last one is 1. @kamlesh71 , am I right?

kamlesh71 commented 3 years ago

@shareef-dweikat @githuboftigran in case of the price range, I want to allow the user to select min and max price but the gap between min and max price should at least 500. Currently, users can select the same value for min and max price at the same time.

For example, I have a price slider which starts from 0 to 5000 If the user select 500 for min value then the max value should not be lesser then 1000

githuboftigran commented 3 years ago

@kamlesh71 , I'll work on this in near future.

githuboftigran commented 2 years ago

@kamlesh71 , finally added support in version 2.1.0: https://www.npmjs.com/package/rn-range-slider/v/2.1.0

However this prevents only user from selecting smaller range. It's possible to programmatically set any values.