From d13d75226e159751fc355135340e17fa36fd8968 Mon Sep 17 00:00:00 2001 From: Arenswald Stephan Date: Thu, 28 Mar 2024 04:02:59 +0100 Subject: [PATCH] fix: global animation overrides animation in item views --- Sources/View/Grid.swift | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Sources/View/Grid.swift b/Sources/View/Grid.swift index 2d59566..638f6bb 100644 --- a/Sources/View/Grid.swift +++ b/Sources/View/Grid.swift @@ -117,7 +117,6 @@ public struct Grid: View, LayoutArranging, LayoutPositioning { .alignmentGuide(.top, computeValue: { _ in self.topGuide(item: item) }) } } - .animation(self.gridAnimation) .frame( flow: self.flow, size: mainGeometry.size, @@ -128,11 +127,13 @@ public struct Grid: View, LayoutArranging, LayoutPositioning { ScrollView(self.scrollAxis) { content } } .onPreferenceChange(GridPreferenceKey.self) { preference in - self.calculateLayout( - preference: preference, - boundingSize: mainGeometry.size - ) - self.saveAlignmentsFrom(preference: preference) + withAnimation(self.gridAnimation) { + self.calculateLayout( + preference: preference, + boundingSize: mainGeometry.size + ) + self.saveAlignmentsFrom(preference: preference) + } } } .id(self.isLoaded)