Skip to content

Commit

Permalink
Resolved animation oddness
Browse files Browse the repository at this point in the history
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
  • Loading branch information
iamgabrielma committed Dec 23, 2024
1 parent 8d723fa commit c8a00b2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions WooCommerce/Classes/POS/Presentation/TotalsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit c8a00b2

Please sign in to comment.