Skip to content

Commit

Permalink
BUGFIX
Browse files Browse the repository at this point in the history
fix:
- Fixed a problem with displaying centre popups in iOS 14
  • Loading branch information
FulcrumOne authored Dec 30, 2023
1 parent d8d9369 commit e126d5c
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions Sources/Internal/Views/PopupCentreStackView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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<CentrePopupConfig>]) {
handlePopupChange(items)
}
}
private extension PopupCentreStackView {
func handlePopupChange(_ items: [AnyPopup<CentrePopupConfig>]) {
guard let popup = items.last else { return handleClosingPopup() }

showNewPopup(popup)
Expand Down

0 comments on commit e126d5c

Please sign in to comment.