Post

Replies

Boosts

Views

Activity

SwiftUI ColorPicker causes layout glitch when used from a sheet with detents
Given a sheet with [.medium] detents, that contains a native ColorPicker in SwiftUI: struct SheetView: View { @State var color: Color = .white var body: some View { ColorPicker( "Color", selection: $color, supportsOpacity: false ) .padding() } } struct ContentView: View { @State var isSheetOpen = false var body: some View { Button("Open Sheet") { isSheetOpen = true } .sheet(isPresented: $isSheetOpen) { SheetView() .presentationDetents([.medium]) } } } When I tap the ColorPicker's color indicator button, it presents the color picker sheet with a layout glitch. During the color picker presentation animation, the original sheet (SheetView) is rapidly pushed up and back down. It is a wild guess but I think it has to do something with keyboard avoidance. Unfortunately, this makes it impossible to use the picker in my app....
3
2
201
Feb ’25