From c8a00b29da8baca25bbf4a01628a572415e7310b Mon Sep 17 00:00:00 2001 From: iamgabrielma Date: Mon, 23 Dec 2024 18:36:11 +0700 Subject: [PATCH] Resolved animation oddness When dismissing the cash view, the animation for cart seems to jump vertically. It seems to be resolved by adding the cash view to matched geometry --- WooCommerce/Classes/POS/Presentation/TotalsView.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/WooCommerce/Classes/POS/Presentation/TotalsView.swift b/WooCommerce/Classes/POS/Presentation/TotalsView.swift index 71670250b1e..1231a0e94fd 100644 --- a/WooCommerce/Classes/POS/Presentation/TotalsView.swift +++ b/WooCommerce/Classes/POS/Presentation/TotalsView.swift @@ -88,13 +88,14 @@ struct TotalsView: View { isShowingTotalsFields = shouldShowTotalsFields } .onChange(of: shouldShowTotalsFields, perform: hideTotalsFieldsWithDelay) - .geometryGroupIfSupported() .fullScreenCover(isPresented: $shouldShowCollectCashPayment) { if case .loaded(let total) = posModel.orderState { - PointOfSaleCollectCashView(isVisible: $shouldShowCollectCashPayment, - orderTotal: total.orderTotal) + PointOfSaleCollectCashView(orderTotal: total.orderTotal) + .matchedGeometryEffect(id: Constants.matchedGeometryCashId, + in: totalsFieldAnimation) } } + .geometryGroupIfSupported() } private var backgroundColor: Color { @@ -338,6 +339,7 @@ private extension TotalsView { static let matchedGeometrySubtotalId: String = "pos_totals_view_subtotal_matched_geometry_id" static let matchedGeometryTaxId: String = "pos_totals_view_tax_matched_geometry_id" static let matchedGeometryTotalId: String = "pos_totals_view_total_matched_geometry_id" + static let matchedGeometryCashId: String = "pos_totals_view_cash_matched_geometry_id" static let totalsFieldsHideAnimationDelay: CGFloat = 0.3 }