Skip to content

Commit

Permalink
Don't use the new iPad modal presentation mode for the timeline item …
Browse files Browse the repository at this point in the history
…menu.
  • Loading branch information
pixlwave committed Sep 24, 2024
1 parent c264e9e commit 3cf8688
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ struct TimelineItemMenu: View {
}
}
.accessibilityIdentifier(A11yIdentifiers.roomScreen.timelineItemActionMenu)
.presentationPage()
.presentationDetents([.medium, .large])
.presentationBackground(Color.compound.bgCanvasDefault)
.presentationDragIndicator(.visible)
Expand Down Expand Up @@ -233,6 +234,17 @@ private extension EncryptionAuthenticity {
}
}

private extension View {
/// Uses the old page style modal so that on iPadOS 18 the presentation detents have no effect.
@ViewBuilder func presentationPage() -> some View {
if #available(iOS 18.0, *) {
presentationSizing(.page)
} else {
self
}
}
}

// MARK: - Previews

struct TimelineItemMenu_Previews: PreviewProvider, TestablePreview {
Expand Down

0 comments on commit 3cf8688

Please sign in to comment.