From cb779685bc589346f48eda5ed8a9327fbdb9f9e0 Mon Sep 17 00:00:00 2001 From: yccheok Date: Sat, 16 Jan 2021 23:44:52 +0800 Subject: [PATCH] 1) Fix animation. 2) Reset transform from dismiss() if this CustomizableActionSheet is being reused. --- CustomizableActionSheet/CustomizableActionSheet.swift | 4 +++- Source/CustomizableActionSheet.swift | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CustomizableActionSheet/CustomizableActionSheet.swift b/CustomizableActionSheet/CustomizableActionSheet.swift index ea44fd7..59a181b 100644 --- a/CustomizableActionSheet/CustomizableActionSheet.swift +++ b/CustomizableActionSheet/CustomizableActionSheet.swift @@ -196,11 +196,13 @@ public class CustomizableActionSheet: NSObject { } let positionX: CGFloat = safeAreaLeft var positionY: CGFloat = targetBounds.minY + targetBounds.height - currentPosition - safeAreaBottom - var moveY: CGFloat = positionY + var moveY: CGFloat = currentPosition if self.position == .top { positionY = CustomizableActionSheet.kItemInterval moveY = -currentPosition } + // Reset transform from dismiss() if this CustomizableActionSheet is being reused. + self.itemContainerView.transform = CGAffineTransform.identity self.itemContainerView.frame = CGRect( x: positionX, y: positionY, diff --git a/Source/CustomizableActionSheet.swift b/Source/CustomizableActionSheet.swift index ea44fd7..59a181b 100644 --- a/Source/CustomizableActionSheet.swift +++ b/Source/CustomizableActionSheet.swift @@ -196,11 +196,13 @@ public class CustomizableActionSheet: NSObject { } let positionX: CGFloat = safeAreaLeft var positionY: CGFloat = targetBounds.minY + targetBounds.height - currentPosition - safeAreaBottom - var moveY: CGFloat = positionY + var moveY: CGFloat = currentPosition if self.position == .top { positionY = CustomizableActionSheet.kItemInterval moveY = -currentPosition } + // Reset transform from dismiss() if this CustomizableActionSheet is being reused. + self.itemContainerView.transform = CGAffineTransform.identity self.itemContainerView.frame = CGRect( x: positionX, y: positionY,