@@ -41,6 +41,8 @@ public struct ChatChannelSwipeableListItem<Factory: ViewFactory, ChannelListItem
41
41
private var trailingRightButtonTapped : ( ChatChannel ) -> Void
42
42
private var trailingLeftButtonTapped : ( ChatChannel ) -> Void
43
43
private var leadingButtonTapped : ( ChatChannel ) -> Void
44
+
45
+ @State private var verticalScrolling = false
44
46
45
47
public init (
46
48
factory: Factory ,
@@ -76,7 +78,7 @@ public struct ChatChannelSwipeableListItem<Factory: ViewFactory, ChannelListItem
76
78
. offset ( x: self . offsetX)
77
79
. simultaneousGesture (
78
80
DragGesture (
79
- minimumDistance: 10 ,
81
+ minimumDistance: 20 ,
80
82
coordinateSpace: . local
81
83
)
82
84
. updating ( $offset) { ( value, gestureState, _) in
@@ -85,7 +87,11 @@ public struct ChatChannelSwipeableListItem<Factory: ViewFactory, ChannelListItem
85
87
width: value. location. x - value. startLocation. x,
86
88
height: value. location. y - value. startLocation. y
87
89
)
88
-
90
+
91
+ if abs ( value. translation. height) > abs ( value. translation. width) && !verticalScrolling {
92
+ verticalScrolling = true
93
+ }
94
+
89
95
if diff == . zero {
90
96
gestureState = . zero
91
97
} else {
@@ -98,7 +104,8 @@ public struct ChatChannelSwipeableListItem<Factory: ViewFactory, ChannelListItem
98
104
if offset == . zero {
99
105
// gesture ended or cancelled
100
106
dragEnded ( )
101
- } else {
107
+ verticalScrolling = false
108
+ } else if !verticalScrolling {
102
109
dragChanged ( to: offset. width)
103
110
}
104
111
} )
@@ -122,7 +129,19 @@ public struct ChatChannelSwipeableListItem<Factory: ViewFactory, ChannelListItem
122
129
}
123
130
124
131
private var showTrailingSwipeActions : Bool {
125
- !( trailingSwipeActions is EmptyView )
132
+ #if DEBUG
133
+ let view = factory. makeTrailingSwipeActionsView (
134
+ channel: channel,
135
+ offsetX: offsetX,
136
+ buttonWidth: buttonWidth,
137
+ swipedChannelId: $swipedChannelId,
138
+ leftButtonTapped: trailingLeftButtonTapped,
139
+ rightButtonTapped: trailingRightButtonTapped
140
+ )
141
+ return !( view is EmptyView )
142
+ #else
143
+ return !( trailingSwipeActions is EmptyView )
144
+ #endif
126
145
}
127
146
128
147
private var leadingSwipeActions : some View {
@@ -136,7 +155,18 @@ public struct ChatChannelSwipeableListItem<Factory: ViewFactory, ChannelListItem
136
155
}
137
156
138
157
private var showLeadingSwipeActions : Bool {
139
- !( leadingSwipeActions is EmptyView )
158
+ #if DEBUG
159
+ let view = factory. makeLeadingSwipeActionsView (
160
+ channel: channel,
161
+ offsetX: offsetX,
162
+ buttonWidth: buttonWidth,
163
+ swipedChannelId: $swipedChannelId,
164
+ buttonTapped: leadingButtonTapped
165
+ )
166
+ return !( view is EmptyView )
167
+ #else
168
+ return !( leadingSwipeActions is EmptyView )
169
+ #endif
140
170
}
141
171
142
172
private func dragChanged( to value: CGFloat ) {
0 commit comments