airbnb / HorizonCalendar

A declarative, performant, iOS calendar UI component that supports use cases ranging from simple date pickers all the way up to fully-featured calendar apps.
Apache License 2.0
2.85k stars 234 forks source link

DayRangeIndicatorView not smooth scrolling #99

Open novpeter opened 3 years ago

novpeter commented 3 years ago

Hi Airbnb Team, I faced with DayRangeIndicatorView problem. When user selects huge date range, for example multiple years, the scroll starts working not smooth. Along with this, there is a jump in RAM consumption. In some moment of scrolling area with selected date range a ton of messages appear in console and selection view disappears. I have the same problem with your demo project.

CoreAnimation: failed to allocate 38375488 bytes
CoreAnimation: failed to allocate 38375488 bytes
CoreAnimation: failed to allocate 38375488 bytes
CoreAnimation: failed to allocate 38375488 bytes

Below the screen recording

https://user-images.githubusercontent.com/26308259/106892167-bc303600-66fc-11eb-94a7-5425d7f57e20.mp4

bryankeller commented 3 years ago

This is indeed a limitation of the current day range architecture. I'm sorry you're running into this!

The root problem is that day range indicator views are set up to cover the entire bounds of the day range, which as you've discovered, can be so large that UIKit will actually fail to render the UIView.

The solution will be a new API (that's similar to the current one) but it segments the drawing for the day range into multiple smaller pieces, rather than one giant piece. Let me do some thinking on this and get back to you in a week... I'd love to have this fixed in the 2.0 release, which I'm working toward currently.

novpeter commented 3 years ago

Thank you for response! Really waiting for it

GeorgeCremer commented 2 years ago

Hey @bryankeller , any word on this fix? I'm running into the same issue....