diff --git a/Example/OpenSwiftUIUITests/View/DynamicViewContent/ForEachUITests.swift b/Example/OpenSwiftUIUITests/View/DynamicViewContent/ForEachUITests.swift index 993f27bf7..d814dd2db 100644 --- a/Example/OpenSwiftUIUITests/View/DynamicViewContent/ForEachUITests.swift +++ b/Example/OpenSwiftUIUITests/View/DynamicViewContent/ForEachUITests.swift @@ -137,4 +137,34 @@ struct ForEachUITests { } openSwiftUIAssertSnapshot(of: ContentView()) } + + @Test( + .bug( + "https://github.com/OpenSwiftUIProject/OpenSwiftUI/issues/655", + id: 655 + ) + ) + func transitionAnimation() { + struct ContentView: AnimationTestView { + nonisolated static var model: AnimationTestModel { + AnimationTestModel(duration: 2.0, count: 4) + } + @State private var items = [6] + + var body: some View { + VStack(spacing: 10) { + ForEach(items, id: \.self) { item in + Color.blue.opacity(Double(item) / 6.0) + .frame(height: 50) + .transition(.slide) + } + } + .animation(.easeInOut(duration: Self.model.duration), value: items) + .onAppear { + items.removeAll { $0 == 6 } + } + } + } + openSwiftUIAssertAnimationSnapshot(of: ContentView()) + } } diff --git a/Sources/OpenSwiftUICore/Animation/Transition/MoveTransition.swift b/Sources/OpenSwiftUICore/Animation/Transition/MoveTransition.swift index 1f0f60aff..26c54702b 100644 --- a/Sources/OpenSwiftUICore/Animation/Transition/MoveTransition.swift +++ b/Sources/OpenSwiftUICore/Animation/Transition/MoveTransition.swift @@ -53,11 +53,11 @@ public struct MoveTransition: Transition { } public func _makeContentTransition(transition: inout _Transition_ContentTransition) { - guard case let .effects(style, size) = transition.operation else { + guard case let .effects(_, size) = transition.operation else { transition.result = .bool(true) return } - let effectiveSize = edge.translationOffset(for: size) + let effectiveSize = edge.translationOffset(for: size) let effect = ContentTransition.Effect(.translation(effectiveSize)) transition.result = .effects([effect]) } diff --git a/Sources/OpenSwiftUICore/Layout/Dynamic/DynamicLayoutView.swift b/Sources/OpenSwiftUICore/Layout/Dynamic/DynamicLayoutView.swift index fa5cf062f..0f0547a3d 100644 --- a/Sources/OpenSwiftUICore/Layout/Dynamic/DynamicLayoutView.swift +++ b/Sources/OpenSwiftUICore/Layout/Dynamic/DynamicLayoutView.swift @@ -226,6 +226,7 @@ struct DynamicLayoutViewAdaptor: DynamicContainerAdaptor { var containerID = DynamicContainerID(uniqueId: uniqueId, viewIndex: 0) let outputs = item.elements.makeAllElements(inputs: inputs) { elementInputs, body in var elementInputs = elementInputs + containerInputs(&elementInputs) if elementInputs.needsGeometry { let childGeometry = Attribute( DynamicLayoutViewChildGeometry(