Don't use the new iPad modal presentation mode for the timeline item menu. (#3325)

This commit is contained in:
Doug 2024-09-24 14:42:45 +01:00 committed by GitHub
parent c264e9e590
commit f772849d2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -51,6 +51,7 @@ struct TimelineItemMenu: View {
}
}
.accessibilityIdentifier(A11yIdentifiers.roomScreen.timelineItemActionMenu)
.presentationPage()
.presentationDetents([.medium, .large])
.presentationBackground(Color.compound.bgCanvasDefault)
.presentationDragIndicator(.visible)
@ -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 {