CodeScanner icon indicating copy to clipboard operation
CodeScanner copied to clipboard

Landscape mode shows wrong orientation for a split second in .sheet()

Open sdavidliu opened this issue 3 years ago • 0 comments

I'm adding CodeScanner into a .sheet() for my iPad app that is primarily in landscape mode. When the sheet appears, the camera is briefly shown rotated 90 degrees, and then it fixes itself within a second. Was wondering if there's a simple fix for this.

Here is my setup:

VStack {
    Button(action: { showModal.toggle() }, label: { Text("Button") })
}
.sheet(isPresented: $showModal, content: {
    VStack {
        CodeScannerView(codeTypes: [.qr], videoCaptureDevice: AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .front)) { response in
            print(response)
        }
    }
})

sdavidliu avatar Dec 08 '22 22:12 sdavidliu