troberts-28 / react-native-timer-picker

A simple, flexible, performant duration picker for React Native apps (Expo & Bare Workflow). Great for timers, alarms and duration inputs. Includes iOS-style haptic and audio feedback.
https://www.npmjs.com/package/react-native-timer-picker
MIT License
143 stars 19 forks source link

disabling infinite scroll with reapeted numbers #34

Closed Noam-m33 closed 3 months ago

Noam-m33 commented 4 months ago

Hi,

The disabling infinite scroll props works fine but we still had the number who is repeated 3 times.

https://github.com/user-attachments/assets/37fc636f-1426-444a-8256-90602fb9a7d8

It's look's like we can easily fix it with this line [Edit: the initialScrollIndex not working with this change]

Capture d’écran 2024-07-29 à 14 08 40

In case it's not a bug and the appropriate behavior of the disable infinite scroll feature it could be great to adding a props to personalize the repeatNTimes.

Thanks for your work !

troberts-28 commented 3 months ago

Hey @Noam-m33!

Thank you for raising this. This isn't actually a bug, but you should absolutely be able to configure the number of times the hours are repeated. I have added three props to allow you to do so for each picker: repeatHourNumbersNTimes, repeatMinuteNumbersNTimes and repeatSecondNumbersNTimes. They are set to 6, 3 and 3, respectively, to give a user the feeling of an endless loop (even when disableInfiniteScroll is set to true). You can set all of these to 1 to avoid any looping at all.