Skip to content

Commit 31fb5d5

Browse files
committed
13701 Prevent shopping bags overlapping with text
At larger dynamic text sizes, the overlay would not be offset enough from the center to clear the text, and they would intersect. Offsetting from the `.top` avoids this issue, since the image is above the text.
1 parent fc645ce commit 31fb5d5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

WooCommerce/Classes/POS/Presentation/CartView.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,14 @@ private extension CartView {
223223
Spacer()
224224
// By designs, the text should be vertically centred with the image 40px above it.
225225
// SwiftUI doesn't allow us to absolutely pin a view to the centre then position other views relative to it
226-
// Instead, we can centre the text, and then put the image in an offset overlay.
226+
// Instead, we can centre the text, and then put the image in an offset overlay. Offsetting from the top
227+
// avoids issues when the text size is changed through dynamic type.
227228
Text(Localization.addItemsToCartHint)
228229
.font(Constants.secondaryFont)
229230
.lineSpacing(Constants.cartEmptyViewTextLineHeight)
230231
.foregroundColor(Color.posTertiaryText)
231232
.multilineTextAlignment(.center)
232-
.overlay(alignment: .center) {
233+
.overlay(alignment: .top) {
233234
Image(decorative: PointOfSaleAssets.shoppingBags.imageName)
234235
.resizable()
235236
.frame(width: Constants.shoppingBagImageSize, height: Constants.shoppingBagImageSize, alignment: .bottom)

0 commit comments

Comments
 (0)