I have created TimelineList using react-native-calendars and I’am trying to get onEventPress to work, but it keeps returning undefined.
I defined the function that handles the click like this:
handleEventPress: TimelineProps["onEventPress"] = (event: Event) => {
console.log(event);
};
I then binded the function to the props like so:
private timelineProps: Partial<TimelineProps> = {
format24h: true,
overlapEventsSpacing: 8,
rightEdgeSpacing: 4,
renderEvent: this.renderEvent,
onBackgroundLongPress: this.handleBackgroundLongPress,
onEventPress: this.handleEventPress,
};
and they are then used in my component like so:
<TimelineList events={this.state.events} timelineProps={this.timelineProps} showNowIndicator scrollToNow />