diff --git a/docsRNC/docs/Components/AgendaList.md b/docsRNC/docs/Components/AgendaList.md
index eff0ba5a46..00fad98cef 100644
--- a/docsRNC/docs/Components/AgendaList.md
+++ b/docsRNC/docs/Components/AgendaList.md
@@ -46,6 +46,11 @@ Whether to block the date change in calendar (and calendar context provider) whe
Whether to enable scrolling the agenda list to the next date with content when pressing a day without content
boolean
+### scrollToSectionDebounce
+
+Delay applied when scrolling to the next date in the agenda after selecting a day, ensuring smooth navigation
+number
+
### viewOffset
Offset scroll to the section
diff --git a/src/expandableCalendar/AgendaListsCommon.tsx b/src/expandableCalendar/AgendaListsCommon.tsx
index 9f861eceb2..35e4f2395e 100644
--- a/src/expandableCalendar/AgendaListsCommon.tsx
+++ b/src/expandableCalendar/AgendaListsCommon.tsx
@@ -23,6 +23,8 @@ export interface AgendaListProps extends SectionListProps
viewOffset?: number;
/** enable scrolling the agenda list to the next date with content when pressing a day without content */
scrollToNextEvent?: boolean;
+ /** debounce in scroll to section. Default = 1000 */
+ scrollToSectionDebounce?: number;
/**
* @experimental
* If defined, uses InfiniteList instead of SectionList. This feature is experimental and subject to change.
diff --git a/src/expandableCalendar/agendaList.api.json b/src/expandableCalendar/agendaList.api.json
index cd3efd6363..f5ee6adc31 100644
--- a/src/expandableCalendar/agendaList.api.json
+++ b/src/expandableCalendar/agendaList.api.json
@@ -47,6 +47,11 @@
"type": "boolean",
"description": "Whether to enable scrolling the agenda list to the next date with content when pressing a day without content"
},
+ {
+ "name": "scrollToSectionDebounce",
+ "type": "number",
+ "description": "Delay applied when scrolling to the next date in the agenda after selecting a day, ensuring smooth navigation."
+ },
{
"name": "viewOffset",
"type": "number",
diff --git a/src/expandableCalendar/agendaList.tsx b/src/expandableCalendar/agendaList.tsx
index a277a106c6..0218230402 100644
--- a/src/expandableCalendar/agendaList.tsx
+++ b/src/expandableCalendar/agendaList.tsx
@@ -64,6 +64,7 @@ const AgendaList = (props: AgendaListProps) => {
useMoment,
markToday = true,
onViewableItemsChanged,
+ scrollToSectionDebounce = 1000
} = props;
const {date, updateSource, setDate, setDisabled} = useContext(Context);
@@ -159,7 +160,7 @@ const AgendaList = (props: AgendaListProps) => {
viewOffset: (constants.isAndroid ? sectionHeight.current : 0) + viewOffset
});
}
- }, 1000, {leading: false, trailing: true}), [viewOffset, sections]);
+ }, scrollToSectionDebounce, {leading: false, trailing: true}), [viewOffset, sections]);
const _onViewableItemsChanged = useCallback((info: {viewableItems: Array; changed: Array}) => {
if (info?.viewableItems && !sectionScroll.current) {
@@ -256,5 +257,6 @@ AgendaList.propTypes = {
useMoment: PropTypes.bool,
markToday: PropTypes.bool,
sectionStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),
- avoidDateUpdates: PropTypes.bool
+ avoidDateUpdates: PropTypes.bool,
+ scrollToSectionDebounce: PropTypes.number
};
diff --git a/src/expandableCalendar/infiniteAgendaList.tsx b/src/expandableCalendar/infiniteAgendaList.tsx
index 5ab91a2c54..7cf60c4a17 100644
--- a/src/expandableCalendar/infiniteAgendaList.tsx
+++ b/src/expandableCalendar/infiniteAgendaList.tsx
@@ -46,6 +46,7 @@ const InfiniteAgendaList = ({
renderItem,
onEndReached,
onEndReachedThreshold,
+ scrollToSectionDebounce = 1000,
...others
}: Omit) => {
const {date, updateSource, setDate} = useContext(Context);
@@ -145,7 +146,7 @@ const InfiniteAgendaList = ({
_onMomentumScrollEnd(); // the RecyclerListView doesn't trigger onMomentumScrollEnd when calling scrollToSection
}, 500);
}
- }, 1000, {leading: false, trailing: true}), [sections]);
+ }, scrollToSectionDebounce, {leading: false, trailing: true}), [sections]);
const layoutProvider = useMemo(
() => new LayoutProvider(
@@ -261,5 +262,6 @@ InfiniteAgendaList.propTypes = {
useMoment: PropTypes.bool,
markToday: PropTypes.bool,
sectionStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),
- avoidDateUpdates: PropTypes.bool
+ avoidDateUpdates: PropTypes.bool,
+ scrollToSectionDebounce: PropTypes.number
};