Skip to content

Commit 457fdd7

Browse files
authored
Delete animation modifier; Add withAnimation block to contentOffset change
1 parent e3ef131 commit 457fdd7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Sources/Views/HStackSnapCore.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public struct HStackSnapCore<Content: View>: View {
3131
HStack {
3232
HStack(spacing: spacing, content: content)
3333
.offset(x: scrollOffset, y: .zero)
34-
.animation(.easeOut(duration: 0.2))
3534

3635
Spacer()
3736
}
@@ -125,7 +124,9 @@ public struct HStackSnapCore<Content: View>: View {
125124
}
126125

127126
// Update state
128-
scrollOffset = closestSnapLocation
127+
withAnimation(.easeOut(duration: 0.2)) {
128+
scrollOffset = closestSnapLocation
129+
}
129130
prevScrollOffset = scrollOffset
130131
}
131132
}

0 commit comments

Comments
 (0)