From 6eec3cd7cb069aae098a70e07d5f39d502b691c9 Mon Sep 17 00:00:00 2001 From: Stefan Ceriu Date: Fri, 30 Jun 2023 12:33:14 +0300 Subject: [PATCH] Prevent the longPressWithFeedback gesture from adding a shadow to its content before the gesture is triggered --- .../Screens/RoomScreen/View/Style/LongPressWithFeedback.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ElementX/Sources/Screens/RoomScreen/View/Style/LongPressWithFeedback.swift b/ElementX/Sources/Screens/RoomScreen/View/Style/LongPressWithFeedback.swift index 0f80c9d26..1fda9f0f4 100644 --- a/ElementX/Sources/Screens/RoomScreen/View/Style/LongPressWithFeedback.swift +++ b/ElementX/Sources/Screens/RoomScreen/View/Style/LongPressWithFeedback.swift @@ -25,8 +25,8 @@ struct LongPressWithFeedback: ViewModifier { func body(content: Content) -> some View { content .compositingGroup() // Apply the shadow to the view as a whole. - .shadow(color: .black.opacity(0.2), radius: isLongPressing ? 12 : 0) - .shadow(color: .black.opacity(0.1), radius: isLongPressing ? 3 : 0) + .shadow(color: .black.opacity(isLongPressing ? 0.2 : 0.0), radius: isLongPressing ? 12 : 0) + .shadow(color: .black.opacity(isLongPressing ? 0.1 : 0.0), radius: isLongPressing ? 3 : 0) .scaleEffect(x: isLongPressing ? 1.05 : 1, y: isLongPressing ? 1.05 : 1) .animation(isLongPressing ? .spring(response: 1.5).delay(0.2) : .spring(response: 0.5),