mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Improved rendering of voice messages (#1782)
This commit is contained in:
@@ -24,7 +24,6 @@ struct SwipeRightAction<Label: View>: ViewModifier {
|
||||
private let feedbackGenerator = UIImpactFeedbackGenerator(style: .heavy)
|
||||
|
||||
@State private var canStartAction = false
|
||||
@State private var animate = false
|
||||
@GestureState private var dragGestureActive = false
|
||||
|
||||
@State private var hasReachedActionThreshold = false
|
||||
@@ -40,7 +39,7 @@ struct SwipeRightAction<Label: View>: ViewModifier {
|
||||
func body(content: Content) -> some View {
|
||||
content
|
||||
.offset(x: xOffset, y: 0.0)
|
||||
.animation(.interactiveSpring().speed(0.5), value: animate)
|
||||
.animation(.interactiveSpring().speed(0.5), value: xOffset)
|
||||
.gesture(DragGesture()
|
||||
.updating($dragGestureActive) { _, state, _ in
|
||||
// Available actions should be computed on the fly so we use a gesture state change
|
||||
@@ -69,7 +68,6 @@ struct SwipeRightAction<Label: View>: ViewModifier {
|
||||
} else {
|
||||
hasReachedActionThreshold = false
|
||||
}
|
||||
animate = true
|
||||
}
|
||||
.onEnded { _ in
|
||||
if xOffset > actionThreshold {
|
||||
@@ -77,7 +75,6 @@ struct SwipeRightAction<Label: View>: ViewModifier {
|
||||
}
|
||||
|
||||
xOffset = 0.0
|
||||
animate = false
|
||||
}
|
||||
)
|
||||
.onChange(of: dragGestureActive, perform: { value in
|
||||
|
||||
Reference in New Issue
Block a user