Skip to content

Commit fc3f857

Browse files
Added swipe gesture to dismiss image gallery
1 parent 3b1ec3d commit fc3f857

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
55

66
### ✅ Added
77
- Possibility to add a custom view above the oldest message in a group
8+
- Swipe gesture to dismiss image gallery
89

910
### 🐞 Fixed
1011
- Memory cache trimming on chat dismiss

Sources/StreamChatSwiftUI/ChatChannel/Gallery/GalleryView.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import SwiftUI
88
/// View used for displaying image attachments in a gallery.
99
struct GalleryView: View {
1010

11+
@Environment(\.presentationMode) var presentationMode
12+
1113
@Injected(\.colors) private var colors
1214
@Injected(\.fonts) private var fonts
1315
@Injected(\.images) private var images
@@ -66,6 +68,13 @@ struct GalleryView: View {
6668
}
6769
.tabViewStyle(.page(indexDisplayMode: .never))
6870
.background(Color(colors.background1))
71+
.gesture(
72+
DragGesture().onEnded { value in
73+
if value.location.y - value.startLocation.y > 100 {
74+
presentationMode.wrappedValue.dismiss()
75+
}
76+
}
77+
)
6978

7079
HStack {
7180
ShareButtonView(content: sharingContent)

0 commit comments

Comments
 (0)