diff --git a/Sources/Internal/Views/PopupCentreStackView.swift b/Sources/Internal/Views/PopupCentreStackView.swift index b97275f47e..67f74ace99 100644 --- a/Sources/Internal/Views/PopupCentreStackView.swift +++ b/Sources/Internal/Views/PopupCentreStackView.swift @@ -34,6 +34,13 @@ struct PopupCentreStackView: PopupStack { private extension PopupCentreStackView { func createPopup() -> some View { + if #available(iOS 15, *) { return createPopupForNewPlatforms() } + else { return createPopupForOlderPlatforms() } + } +} + +private extension PopupCentreStackView { + func createPopupForNewPlatforms() -> some View { activeView? .readHeight(onChange: saveHeight) .frame(height: height).frame(maxWidth: .infinity) @@ -43,16 +50,20 @@ private extension PopupCentreStackView { .compositingGroup() .focusSectionIfAvailable() } + func createPopupForOlderPlatforms() -> some View { + items.last?.body + .readHeight(onChange: saveHeight) + .frame(height: height).frame(maxWidth: .infinity) + .background(backgroundColour, overlayColour: .clear, radius: cornerRadius, corners: .allCorners, shadow: popupShadow) + .padding(.horizontal, lastPopupConfig.horizontalPadding) + .compositingGroup() + .focusSectionIfAvailable() + } } // MARK: - Logic Modifiers private extension PopupCentreStackView { func onItemsChange(_ items: [AnyPopup]) { - handlePopupChange(items) - } -} -private extension PopupCentreStackView { - func handlePopupChange(_ items: [AnyPopup]) { guard let popup = items.last else { return handleClosingPopup() } showNewPopup(popup)