Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/timeline/Timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import times from 'lodash/times';
import groupBy from 'lodash/groupBy';

import React, {useCallback, useEffect, useMemo, useRef} from 'react';
import {View, ScrollView} from 'react-native';
import {View, ScrollView, NativeSyntheticEvent, NativeScrollEvent} from 'react-native';

import constants from '../commons/constants';
import {generateDay} from '../dateutils';
Expand Down Expand Up @@ -115,6 +115,11 @@ export interface TimelineProps {
timelineLeftInset?: number;
/** Identifier for testing */
testID?: string;
/**
* Callback fired when the Timeline's internal ScrollView scrolls.
* Receives the native scroll event to allow consumers to track scroll position or implement custom behaviors.
*/
onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
}

const Timeline = (props: TimelineProps) => {
Expand Down Expand Up @@ -142,7 +147,8 @@ const Timeline = (props: TimelineProps) => {
eventTapped,
numberOfDays = 1,
timelineLeftInset = 0,
testID
testID,
onScroll
} = props;

const pageDates = useMemo(() => {
Expand Down Expand Up @@ -252,6 +258,7 @@ const Timeline = (props: TimelineProps) => {
showsVerticalScrollIndicator={false}
{...scrollEvents}
testID={testID}
onScroll={onScroll}
>
<TimelineHours
start={start}
Expand Down