File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
Sources/StreamChatSwiftUI/ChatChannel/MessageList/Polls Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -198,11 +198,7 @@ struct PollOptionView: View {
198
198
HStack ( alignment: . top, spacing: checkboxButtonSpacing) {
199
199
if !viewModel. poll. isClosed {
200
200
Button {
201
- if viewModel. optionVotedByCurrentUser ( option) {
202
- viewModel. removePollVote ( for: option)
203
- } else {
204
- viewModel. castPollVote ( for: option)
205
- }
201
+ togglePollVote ( )
206
202
} label: {
207
203
if viewModel. optionVotedByCurrentUser ( option) {
208
204
Image ( systemName: " checkmark.circle.fill " )
@@ -239,6 +235,18 @@ struct PollOptionView: View {
239
235
}
240
236
}
241
237
}
238
+ . contentShape ( Rectangle ( ) )
239
+ . onTapGesture {
240
+ togglePollVote ( )
241
+ }
242
+ }
243
+
244
+ func togglePollVote( ) {
245
+ if viewModel. optionVotedByCurrentUser ( option) {
246
+ viewModel. removePollVote ( for: option)
247
+ } else {
248
+ viewModel. castPollVote ( for: option)
249
+ }
242
250
}
243
251
}
244
252
You can’t perform that action at this time.
0 commit comments