From fc2c17644f4e5ac1406b0ccb6204b1f5f1a92aa4 Mon Sep 17 00:00:00 2001 From: Salim Braksa Date: Thu, 9 May 2024 01:12:24 +0100 Subject: [PATCH] Define transition and animation delay as constants --- .../Comment Moderation/CommentModerationView.swift | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationView.swift b/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationView.swift index 5d0b82f95ab6..2742dafda005 100644 --- a/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationView.swift +++ b/WordPress/Classes/ViewRelated/Notifications/Comment Moderation/CommentModerationView.swift @@ -36,9 +36,17 @@ private struct Container: View { let icon: V let content: T + private var transition: AnyTransition = .opacity + private let animationDuration = 0.25 - private var animation: Animation { + private let insertionAnimationDelay = 0.8 + + private var insertionAnimation: Animation { + return removalAnimation.delay(insertionAnimationDelay) + } + + private var removalAnimation: Animation { return .smooth(duration: animationDuration) } @@ -56,8 +64,8 @@ private struct Container: View { .padding(.horizontal, .DS.Padding.double) .transition( .asymmetric( - insertion: .opacity.animation(animation.delay(animationDuration * 0.8)), - removal: .opacity.animation(animation) + insertion: transition.animation(insertionAnimation), + removal: transition.animation(removalAnimation) ) ) }