(Required) Version Number: 8.02
If you select one of the last dates in the MonthView, then after call method scrollToDate() calendar scrolls too high and leaves empty space under it. This method works differently in CalendarView.
You can reproduce it yourself.
scrollToDate() and pass selected dateThe selected date should not be aligned to top leave an empty space under it.
It is worth paying attention to the implementation of this method in the CalendarView. There calculation a valid point to scroll is implemented differently.
I created a demo-project and short video with this bug and will attach it.
youre using cocoapods.
let me test a quick-fix. If it works i will do a proper official fix later this week.
Go to the file JTACInteractionMonthFunctions.swift
Goto line 550
replace the the code from line 550 till the end of the function, with this code
if scrollingMode == .none {
self.scrollToItem(at: sectionIndexPath, at: preferredScrollPosition ?? (scrollDirection == .horizontal ? .left : .top), animated: true)
} else {
guard let point = targetPointForItemAt(indexPath: sectionIndexPath) else {
assert(false, "Could not determine CGPoint. This is an error. contact developer on github. In production, there will not be a crash, but scrolling will not occur")
return
}
scrollTo(point: point,
triggerScrollToDateDelegate: triggerScrollToDateDelegate,
isAnimationEnabled: animateScroll,
extraAddedOffset: extraAddedOffset,
completionHandler: completionHandler)
}
Press SHIFT + CMD + K to clean your project. (Sometimes Xcode caches the old cocoapod build and you need to clean so that XCode can reflect the code change).
Now run your app. Let me know if it works.
Yes, it works. You just need to add a calling the completion handler.
@patchthecode Will the planned fix also pass preferredScrollPosition from the public scrollToDate public method to the internal one? (currently it is being discarded)
@patchthecode Added a PR: https://github.com/patchthecode/JTAppleCalendar/pull/1175
Most helpful comment
@patchthecode Will the planned fix also pass preferredScrollPosition from the public scrollToDate public method to the internal one? (currently it is being discarded)