Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slow Rendering as the number of events increases in week/day view #820

Closed
nairash94 opened this issue Feb 1, 2023 · 2 comments
Closed

Comments

@nairash94
Copy link

nairash94 commented Feb 1, 2023

Hi @acro5piano thanks a lot for creating this library . Much Appreciated!!
I've been noticing the slowness on the iOS IPad simulator whenever i try to change to previous or next week, it takes a lot of time to load the updated calendar component.
I have identified the major bottleneck to be eventCount and eventOrder props in _renderMappedEvent function in CalendarBody.tsx. This 2 props presently goes through the entire eventList for every single event causing a major lag when the number of events increases to more than 10. So we can make this an optional prop in this function.
if we don't send these props, the performance is improving drastically with less freeze time.

const _renderMappedEvent = React.useCallback(
(event: T, index: number) => {
return (
<CalendarEvent
key={`${index}${event.start}${event.title}${event.end}`}
event={event}
onPressEvent={onPressEvent}
eventCellStyle={eventCellStyle}
showTime={showTime}
eventCount={getCountOfEventsAtEvent(event, events)}
eventOrder={getOrderOfEvent(event, events)}
overlapOffset={overlapOffset}
renderEvent={renderEvent}
ampm={ampm}
/>
)
},
[ampm, eventCellStyle, events, onPressEvent, overlapOffset, renderEvent, showTime],
)

I know it supports a major feature in this plugin, but i believe it would be really helpful if we can have more control over whether to use it or not.

@acro5piano
Copy link
Owner

Thanks for your PR. I've published v3.4.0 and it will be fixed. Let me know if you have any troubles after updating!

@marko-mlinarevic
Copy link

I'm having this issue on android. Using your react native demo example. it's very slow couple of seconds to load everything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants