@@ -10,6 +10,8 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
10
10
11
11
@StateObject var viewModel : ReactionsOverlayViewModel
12
12
13
+ @State private var popIn = false
14
+
13
15
var factory : Factory
14
16
var channel : ChatChannel
15
17
var currentSnapshot : UIImage
@@ -84,6 +86,8 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
84
86
isFirst: messageDisplayInfo. isFirst,
85
87
scrolledId: . constant( nil )
86
88
)
89
+ . scaleEffect ( popIn ? 1 : 0.95 )
90
+ . animation ( popInAnimation, value: popIn)
87
91
. offset (
88
92
x: messageDisplayInfo. frame. origin. x - diffWidth
89
93
)
@@ -97,9 +101,11 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
97
101
onBackgroundTap ( )
98
102
}
99
103
)
104
+ . scaleEffect ( popIn ? 1 : 0 )
105
+ . animation ( popInAnimation, value: popIn)
100
106
. offset (
101
107
x: messageDisplayInfo. frame. origin. x - diffWidth,
102
- y: - 24
108
+ y: popIn ? - 24 : - messageDisplayInfo . frame . height / 2
103
109
)
104
110
: nil
105
111
)
@@ -121,9 +127,13 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
121
127
)
122
128
. frame ( width: messageActionsWidth)
123
129
. 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
125
133
)
126
134
. padding ( . top, paddingValue)
135
+ . scaleEffect ( popIn ? 1 : 0 )
136
+ . animation ( popInAnimation, value: popIn)
127
137
} else {
128
138
factory. makeReactionsUsersView (
129
139
message: viewModel. message,
@@ -135,12 +145,21 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
135
145
)
136
146
. padding ( . top, messageDisplayInfo. message. isSentByCurrentUser ? paddingValue : 2 * paddingValue)
137
147
. padding ( . trailing, paddingValue)
148
+ . scaleEffect ( popIn ? 1 : 0 )
149
+ . animation ( popInAnimation, value: popIn)
138
150
}
139
151
}
140
152
. offset ( y: originY)
141
153
}
142
154
}
143
155
. 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 )
144
163
}
145
164
146
165
private var userReactionsHeight : CGFloat {
0 commit comments