add spring animation to list view

This commit is contained in:
Trey t
2022-03-29 22:00:39 -05:00
parent 3ab30345f1
commit 879c87f014

View File

@@ -188,9 +188,7 @@ struct HomeView: View {
VStack { VStack {
if ShowBasedOnVoteLogics.isMissingCurrentVote(onboardingData: onboardingData.savedOnboardingData) { if ShowBasedOnVoteLogics.isMissingCurrentVote(onboardingData: onboardingData.savedOnboardingData) {
AddMoodHeaderView(addItemHeaderClosure: { (mood, date) in AddMoodHeaderView(addItemHeaderClosure: { (mood, date) in
withAnimation { viewModel.add(mood: mood, forDate: date, entryType: .header)
viewModel.add(mood: mood, forDate: date, entryType: .header)
}
}) })
.frame(height: headerHeight) .frame(height: headerHeight)
.frame(minWidth: 0, maxWidth: .infinity) .frame(minWidth: 0, maxWidth: .infinity)
@@ -251,7 +249,9 @@ struct HomeView: View {
} }
} }
} }
}.background( }
.animation(Animation.spring(response: 0.3, dampingFraction: 0.5, blendDuration: 1))
.background(
GeometryReader { proxy in GeometryReader { proxy in
let offset = proxy.frame(in: .named("scroll")).minY let offset = proxy.frame(in: .named("scroll")).minY
Color.clear.preference(key: ViewOffsetKey.self, value: offset) Color.clear.preference(key: ViewOffsetKey.self, value: offset)