 extension CalendarViewController: UIScrollViewDelegate {
     func scrollViewDidScroll(_ scrollView: UIScrollView) {
         eventsView.contentOffset = scrollView.contentOffset
-        updateTimesViewLayoutIfNeeded()
+        invalidateTimesViewLayoutIfNeeded(animated: true)
     }
     
-    func updateTimesViewLayoutIfNeeded() {
+    func invalidateTimesViewLayoutIfNeeded(animated: Bool) {
         let indexPaths = timesView.indexPathsForVisibleItems.sorted()
         if indexPaths.isEmpty {
             return

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        
        updateTimesViewLayoutIfNeeded()
    }
    
    private func setupNavigationBar() {

        if timesViewLayout.centerIndexPath != centerIndexPath {
            timesViewLayout.centerIndexPath = centerIndexPath
            
            let actions = {
                self.timesViewLayout.invalidateLayout()
            }
            
            if animated {
                UIView.animate(withDuration: 0.6, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0, animations: actions)
            } else {
                actions()
            }
        }
    }
}
