Skip to content

Commit 36740d1

Browse files
authored
[Woo POS] Don't ignore safe area at the root of POS modal (#16121)
2 parents 95a8b27 + 313c367 commit 36740d1

File tree

1 file changed

+47
-1
lines changed

1 file changed

+47
-1
lines changed

WooCommerce/Classes/POS/Presentation/Reusable Views/POSModalViewModifier.swift

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ struct POSRootModalViewModifier: ViewModifier {
4343
}
4444
}
4545
.animation(.easeInOut(duration: animationDuration), value: modalManager.isPresented)
46-
.ignoresSafeArea()
4746
}
4847

4948
private func updateModalParentSize(with size: CGSize) {
@@ -212,3 +211,50 @@ extension EnvironmentValues {
212211
set { self[POSModalParentSizeKey.self] = newValue }
213212
}
214213
}
214+
215+
// MARK: - Previews for testing popular modals
216+
217+
#if DEBUG
218+
#Preview("Card Present Alert") {
219+
@Previewable @StateObject var modalManager = POSModalManager()
220+
@Previewable @StateObject var coverManager = POSFullScreenCoverManager()
221+
@Previewable @State var showModal = false
222+
223+
return VStack {
224+
Color.blue
225+
.ignoresSafeArea(.all)
226+
.onAppear {
227+
showModal = true
228+
}
229+
}
230+
.posModal(isPresented: $showModal) {
231+
PointOfSaleCardPresentPaymentAlert(alertType: .connectionSuccess(
232+
viewModel: PointOfSaleCardPresentPaymentConnectionSuccessAlertViewModel(doneAction: {
233+
})
234+
))
235+
}
236+
.posRootModal()
237+
.environmentObject(modalManager)
238+
.environmentObject(coverManager)
239+
}
240+
241+
#Preview("Barcode Scanner Setup") {
242+
@Previewable @StateObject var modalManager = POSModalManager()
243+
@Previewable @StateObject var coverManager = POSFullScreenCoverManager()
244+
@Previewable @State var showModal = false
245+
246+
return VStack {
247+
Color.blue
248+
.ignoresSafeArea(.all)
249+
.onAppear {
250+
showModal = true
251+
}
252+
}
253+
.posModal(isPresented: $showModal) {
254+
PointOfSaleBarcodeScannerSetup(isPresented: $showModal)
255+
}
256+
.posRootModal()
257+
.environmentObject(modalManager)
258+
.environmentObject(coverManager)
259+
}
260+
#endif

0 commit comments

Comments
 (0)