File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
Sources/StreamChatSwiftUI/ChatChannel/MessageList Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -103,7 +103,12 @@ struct LazyGiphyView: View {
103
103
var body : some View {
104
104
LazyImage ( imageURL: source) { state in
105
105
if let imageContainer = state. imageContainer {
106
- Image ( uiImage: imageContainer. image)
106
+ if imageContainer. type == . gif {
107
+ AnimatedGifView ( imageContainer: imageContainer)
108
+ . frame ( width: width)
109
+ } else {
110
+ state. image
111
+ }
107
112
} else if state. error != nil {
108
113
Color ( . secondarySystemBackground)
109
114
} else {
@@ -119,3 +124,18 @@ struct LazyGiphyView: View {
119
124
. aspectRatio ( contentMode: . fit)
120
125
}
121
126
}
127
+
128
+ private struct AnimatedGifView : UIViewRepresentable {
129
+ let imageContainer : ImageContainer
130
+
131
+ func makeUIView( context: Context ) -> UIImageView {
132
+ let imageView = UIImageView ( )
133
+ imageView. contentMode = . scaleAspectFit
134
+ if let gifData = imageContainer. data, let image = try ? UIImage ( gifData: gifData) {
135
+ imageView. setGifImage ( image)
136
+ }
137
+ return imageView
138
+ }
139
+
140
+ func updateUIView( _ uiView: UIImageView , context: Context ) { }
141
+ }
You can’t perform that action at this time.
0 commit comments