Skip to content

Commit e26bac3

Browse files
committed
🩹 change default repeatHourNumbersNTimes to 7 for better consistency with minutes/seconds pickers
1 parent 29debc8 commit e26bac3

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ return (
449449
| use12HourPicker | Switch the hour picker to 12-hour format with an AM / PM label | Boolean | false | false |
450450
| amLabel | Set the AM label if using the 12-hour picker | String | am | false |
451451
| pmLabel | Set the PM label if using the 12-hour picker | String | pm | false |
452-
| repeatHourNumbersNTimes | Set the number of times the list of hours is repeated in the picker | Number | 6 | false |
452+
| repeatHourNumbersNTimes | Set the number of times the list of hours is repeated in the picker | Number | 7 | false |
453453
| repeatMinuteNumbersNTimes | Set the number of times the list of minutes is repeated in the picker | Number | 3 | false |
454454
| repeatSecondNumbersNTimes | Set the number of times the list of seconds is repeated in the picker | Number | 3 | false |
455455
| disableInfiniteScroll | Disable the infinite scroll feature | Boolean | false | false |
@@ -491,7 +491,7 @@ Note the minor limitations to the allowed styles for `pickerContainer` and `pick
491491

492492
When the `disableInfiniteScroll` prop is not set, the picker gives the appearance of an infinitely scrolling picker by auto-scrolling forward/back when you near the start/end of the list. When the picker auto-scrolls, a momentary flicker is visible if you are scrolling very slowly.
493493

494-
To mitigate for this, you can modify the `repeatHourNumbersNTimes`, `repeatMinuteNumbersNTimes` and `repeatSecondNumbersNTimes` props. These set the number of times the list of numbers in each picker is repeated. These have a performance trade-off: higher values mean the picker has to auto-scroll less to maintain the infinite scroll, but has to render a longer list of numbers. By default, the props are set to 6, 3 and 3, respectively, which balances that trade-off effectively.
494+
To mitigate for this, you can modify the `repeatHourNumbersNTimes`, `repeatMinuteNumbersNTimes` and `repeatSecondNumbersNTimes` props. These set the number of times the list of numbers in each picker is repeated. These have a performance trade-off: higher values mean the picker has to auto-scroll less to maintain the infinite scroll, but has to render a longer list of numbers. By default, the props are set to 7, 3 and 3, respectively, which balances that trade-off effectively.
495495

496496
Note that you can avoid the auto-scroll flickering entirely by disabling infinite scroll. You could then set the above props to high values, so that a user has to scroll far down/up the list to reach the end of the list.
497497

‎example/App.tsx‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ export default function App() {
107107
<TimerPickerModal
108108
Audio={Audio}
109109
closeOnOverlayPress
110-
disableInfiniteScroll
111110
Haptics={Haptics}
112111
LinearGradient={LinearGradient}
113112
modalProps={{
@@ -119,9 +118,6 @@ export default function App() {
119118
setAlarmStringExample1(formatTime(pickedDuration));
120119
setShowPickerExample1(false);
121120
}}
122-
repeatHourNumbersNTimes={1}
123-
repeatMinuteNumbersNTimes={1}
124-
repeatSecondNumbersNTimes={1}
125121
setIsVisible={setShowPickerExample1}
126122
styles={{
127123
theme: "dark",

‎src/components/TimerPicker/index.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const TimerPicker = forwardRef<TimerPickerRef, TimerPickerProps>(
3939
padWithNItems = 1,
4040
pickerContainerProps,
4141
pmLabel = "pm",
42-
repeatHourNumbersNTimes = 6,
42+
repeatHourNumbersNTimes = 7,
4343
repeatMinuteNumbersNTimes = 3,
4444
repeatSecondNumbersNTimes = 3,
4545
secondLabel,

0 commit comments

Comments
 (0)