ptomasroos/react-native-multi-slider

max value

sandeep855 opened this issue · 2 comments

if you pass a value in max greater than 6 digits eg: max={9999999} It hangs your device to load this value. Sometimes crashes the app.

for (let i = 0; i < length; i++) {
result.push(start + i * Math.abs(step) * direction);
}

For very large min & max and very small step, above loop generates very large array which causes the crash. Better to dynamically use the step value like

step = Math.round(Math.abs(max - min) / 100)

This will force the loop to execute only 100 times.

Hope this helps.

Thanks! Added to the readme @sheralim012