I need a transparent List
(because of some particular background) and each list item with a ContextMenu
, iOS 17+.
The problem here is: when the list item’s height is bigger than the list’s one and has a
.listRowBackground(Color.clear)
modifier on it, on iPad I see the following glitch:
video:
https://imgur.com/cxSYUvI
Unfortunately, the bug is not present in previews or simulators (not sure about iPhone).
Demonstration
The issue is perfectly reproducible with the following simple code:
import SwiftUI
struct ContentView: View {
var message = Array(0 ..< 200).map { _ in "SOME SOME SOME SOME" }.joined(separator: "n")
var body: some View {
List {
Text(message)
.contextMenu {
Button {
// Some action
} label: {
Text("Some Action")
}
}
.listRowBackground(Color.clear)
}
}
}
What I tried
What I already tried:
- using
Color.white.opacity(0.01)
instead ofColor.clear
- using custom ContextMenu preview (for some reason the size of the preview is completely wrong even for a simple
Text
)