From 2a78d4c00314bcf386b57833348ea9c7b6b65832 Mon Sep 17 00:00:00 2001 From: Mikhail Date: Tue, 24 Feb 2026 11:30:52 +0800 Subject: [PATCH] fix modal dismiss animation and completion handling --- .../Components/Modal/UIKit/UKBottomModalController.swift | 4 ++-- .../Components/Modal/UIKit/UKCenterModalController.swift | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/ComponentsKit/Components/Modal/UIKit/UKBottomModalController.swift b/Sources/ComponentsKit/Components/Modal/UIKit/UKBottomModalController.swift index 49ef36d..802a14d 100644 --- a/Sources/ComponentsKit/Components/Modal/UIKit/UKBottomModalController.swift +++ b/Sources/ComponentsKit/Components/Modal/UIKit/UKBottomModalController.swift @@ -104,11 +104,11 @@ public class UKBottomModalController: UKModalController { animated flag: Bool, completion: (() -> Void)? = nil ) { - UIView.animate(withDuration: self.model.transition.value) { + UIView.animate(withDuration: flag ? self.model.transition.value : 0.0) { self.contentView.transform = .init(translationX: 0, y: self.view.screenBounds.height) self.overlay.alpha = 0 } completion: { _ in - super.dismiss(animated: false) + super.dismiss(animated: false, completion: completion) } } } diff --git a/Sources/ComponentsKit/Components/Modal/UIKit/UKCenterModalController.swift b/Sources/ComponentsKit/Components/Modal/UIKit/UKCenterModalController.swift index fffdc56..8f6387c 100644 --- a/Sources/ComponentsKit/Components/Modal/UIKit/UKCenterModalController.swift +++ b/Sources/ComponentsKit/Components/Modal/UIKit/UKCenterModalController.swift @@ -105,11 +105,11 @@ public class UKCenterModalController: UKModalController { animated flag: Bool, completion: (() -> Void)? = nil ) { - UIView.animate(withDuration: self.model.transition.value) { + UIView.animate(withDuration: flag ? self.model.transition.value : 0.0) { self.overlay.alpha = 0 self.contentView.alpha = 0 } completion: { _ in - super.dismiss(animated: false) + super.dismiss(animated: false, completion: completion) } } }