Skip to content

Commit 107d8e3

Browse files
committed
Prefer an overlay over a zstack
1 parent a44f9a3 commit 107d8e3

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

WooCommerce/Classes/View Modifiers/View+NoticesModifier.swift

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@ struct NoticeModifier: ViewModifier {
1010
let notice: Notice
1111

1212
func body(content: Content) -> some View {
13-
// Geometry reader to provide the correct view width.
14-
GeometryReader { geometry in
15-
ZStack {
16-
17-
// Main content
18-
content
19-
13+
content.overlay(
14+
// Geometry reader to provide the correct view width.
15+
GeometryReader { geometry in
2016
// VStack with spacer to push content to the bottom
2117
VStack {
2218
Spacer()
@@ -26,7 +22,7 @@ struct NoticeModifier: ViewModifier {
2622
.fixedSize(horizontal: false, vertical: true)
2723
}
2824
}
29-
}
25+
)
3026
}
3127
}
3228

@@ -79,7 +75,7 @@ private extension NoticeAlert {
7975

8076
/// Notice view padding.
8177
///
82-
let defaultInsets = UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16)
78+
let defaultInsets = UIEdgeInsets(top: 16, left: 16, bottom: 28, right: 16)
8379

8480
init(noticeView: NoticeView) {
8581
self.noticeView = noticeView
@@ -128,7 +124,7 @@ extension View {
128124

129125
struct NoticeModifier_Previews: PreviewProvider {
130126
static var previews: some View {
131-
Text("")
127+
Rectangle().foregroundColor(.white)
132128
.notice(
133129
.init(title: "API Error",
134130
subtitle: "Restricted Access",

0 commit comments

Comments
 (0)