@@ -10,6 +10,8 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
1010
1111 @StateObject var viewModel : ReactionsOverlayViewModel
1212
13+ @State private var popIn = false
14+
1315 var factory : Factory
1416 var channel : ChatChannel
1517 var currentSnapshot : UIImage
@@ -84,6 +86,8 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
8486 isFirst: messageDisplayInfo. isFirst,
8587 scrolledId: . constant( nil )
8688 )
89+ . scaleEffect ( popIn ? 1 : 0.95 )
90+ . animation ( popInAnimation, value: popIn)
8791 . offset (
8892 x: messageDisplayInfo. frame. origin. x - diffWidth
8993 )
@@ -97,9 +101,11 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
97101 onBackgroundTap ( )
98102 }
99103 )
104+ . scaleEffect ( popIn ? 1 : 0 )
105+ . animation ( popInAnimation, value: popIn)
100106 . offset (
101107 x: messageDisplayInfo. frame. origin. x - diffWidth,
102- y: - 24
108+ y: popIn ? - 24 : - messageDisplayInfo . frame . height / 2
103109 )
104110 : nil
105111 )
@@ -121,9 +127,13 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
121127 )
122128 . frame ( width: messageActionsWidth)
123129 . offset (
124- x: messageActionsOriginX ( availableWidth: reader. size. width)
130+ x: popIn ? messageActionsOriginX ( availableWidth: reader. size. width) :
131+ ( messageDisplayInfo. message. isSentByCurrentUser ? messageActionsWidth : 0 ) ,
132+ y: popIn ? 0 : - messageActionsSize / 2
125133 )
126134 . padding ( . top, paddingValue)
135+ . scaleEffect ( popIn ? 1 : 0 )
136+ . animation ( popInAnimation, value: popIn)
127137 } else {
128138 factory. makeReactionsUsersView (
129139 message: viewModel. message,
@@ -135,12 +145,21 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
135145 )
136146 . padding ( . top, messageDisplayInfo. message. isSentByCurrentUser ? paddingValue : 2 * paddingValue)
137147 . padding ( . trailing, paddingValue)
148+ . scaleEffect ( popIn ? 1 : 0 )
149+ . animation ( popInAnimation, value: popIn)
138150 }
139151 }
140152 . offset ( y: originY)
141153 }
142154 }
143155 . edgesIgnoringSafeArea ( . all)
156+ . onAppear {
157+ popIn = true
158+ }
159+ }
160+
161+ private var popInAnimation : Animation {
162+ . spring( response: 0.2 , dampingFraction: 0.7 , blendDuration: 0.2 )
144163 }
145164
146165 private var userReactionsHeight : CGFloat {
0 commit comments