Фикс: race condition свайп-минимизации call bar + асимметричный transition оверлея

This commit is contained in:
2026-03-30 20:18:43 +05:00
parent f24f7ee555
commit dcefce7cd5
10 changed files with 139 additions and 34 deletions

View File

@@ -39,7 +39,16 @@ final class CallBarInsetView: UIView {
func applyInset() {
guard topInset != lastAppliedInset else { return }
guard let window, let rootVC = window.rootViewController else { return }
Self.apply(inset: topInset, in: rootVC)
let inset = topInset
// Animate in sync with SwiftUI spring transition to avoid jerk.
// layoutIfNeeded() forces the layout pass INSIDE the animation block
// without it, additionalSafeAreaInsets triggers layout on the next
// run loop pass, which is outside the animation scope instant jump.
UIView.animate(withDuration: 0.4, delay: 0, usingSpringWithDamping: 0.85,
initialSpringVelocity: 0, options: [.beginFromCurrentState]) {
Self.apply(inset: inset, in: rootVC)
rootVC.view.layoutIfNeeded()
}
lastAppliedInset = topInset
}