@@ -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