Skip to content

Commit

Permalink
Revert change in PR: Fixed the invalidating heights animation wayfair…
Browse files Browse the repository at this point in the history
…-archive#164. This fixes issue where scrolling in a carousel that used collection brick caused cells above to re-size to a smaller size than what was already calculated
  • Loading branch information
wfsttam committed Sep 15, 2017
1 parent 427b379 commit 14bfaf2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Source/Layout/BrickFlowLayout.swift
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,14 @@ extension BrickFlowLayout: BrickLayoutSectionDataSource {
var size: CGSize = .zero
switch type {
case .brick:
let height = _dataSource.brickLayout(self, estimatedHeightForItemAt: indexPath, containedIn: width)
size = CGSize(width: width, height: height)
// Check if the attributes already had a height. If so, use that height
if attributes.frame.height != 0 && _dataSource.brickLayout(self, isEstimatedHeightFor: indexPath) {
let height = attributes.frame.size.height
size = CGSize(width: width, height: height)
} else {
let height = _dataSource.brickLayout(self, estimatedHeightForItemAt: indexPath, containedIn: width)
size = CGSize(width: width, height: height)
}
case .section(let section):
let height = _dataSource.brickLayout(self, estimatedHeightForItemAt: indexPath, containedIn: width)
if height == 0 {
Expand Down

0 comments on commit 14bfaf2

Please sign in to comment.