Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Sources/AloeStackView/AloeStackView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ open class AloeStackView: UIScrollView {
guard let cell = row.superview as? StackViewCell, cell.isHidden != isHidden else { return }

if animated {
cell.layoutIfNeeded()
UIView.animate(withDuration: 0.3) {
cell.isHidden = isHidden
cell.layoutIfNeeded()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this second layout call needed now?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is the second call, within the animation block, that actually animates the constraint change (via isHidden).

That said, I spoke too soon and this did not actually fix my problem. What is happening is multiple calls to setRowHidden(true) are "accumulating" and setRowHidden(false) does not take effect until it's called enough times to "balance" all the hides. There is a unit test in the project for this scenario - and it passes - but that is exactly what I'm seeing.

I've presently wrapped the call to setRowHidden() in isRowHidden() to execute only when there's a change but that's, well, gross. I'm perplexed.

Expand Down