Skip to content

Commit

Permalink
Adjust the timing of button reaction
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuzukihashi committed Apr 22, 2020
1 parent d15ecac commit 071db9c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/CustomViews/HighlightableButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ public struct HighlightableButton<Label>: View where Label: View {
withAnimation {
self.isHighlighted = true
}}
.onEnded { _ in
self.action()
.onEnded { value in
if abs(value.translation.height) <= 64 {
self.action()
}
withAnimation {
self.isHighlighted = false
}})
Expand Down

0 comments on commit 071db9c

Please sign in to comment.