Don't update constraints from StatusContentContainer.setCollapsed

This commit is contained in:
Shadowfacts 2023-05-14 15:53:24 -04:00
parent 421cb7ba03
commit 3b965b92f2
1 changed files with 6 additions and 5 deletions

View File

@ -130,11 +130,12 @@ class StatusContentContainer<ContentView: ContentTextView, PollView: StatusConte
}
isCollapsed = collapsed
// ensure that we have a lastSubviewBottomConstraint
updateConstraintsIfNeeded()
// force unwrap because the content container should always have at least one view
lastSubviewBottomConstraint!.isActive = !collapsed
zeroHeightConstraint.isActive = collapsed
// don't call setNeedsUpdateConstraints b/c that destroys/recreates a bunch of other constraints
// if there is no lastSubviewBottomConstraint, then we already need a constraint update, so we don't need to do anything here
if let lastSubviewBottomConstraint {
lastSubviewBottomConstraint.isActive = !collapsed
zeroHeightConstraint.isActive = collapsed
}
}
// used only for collapsing automatically based on height, doesn't need to be accurate