SwiftfulThinking / SwiftfulRouting

Programmatic navigation for SwiftUI applications.
https://www.swiftful-thinking.com/
MIT License
492 stars 32 forks source link

Safe Area Blinking in Resizable Sheet Until Transition Completes #77

Open stackmak21 opened 1 month ago

stackmak21 commented 1 month ago

When presenting a resizable sheet using showResizableSheet function, the safe area briefly blinks or flickers until the transition completes. This happens specifically when the sheet first appears, and it seems to be related to safe area adjustments during the presentation animation. Notably, when using the built-in .sheet view modifier, the transition works perfectly without any flicker. The custom sheet uses specific detents, and there may be state or layout recalculations involved causing this temporary blinking effect. Has anyone encountered this issue or found a way to stabilize the safe area during such transitions? Note: This bug seems to dissapear when the sheet content composed of a List.

Issue video: https://github.com/user-attachments/assets/9323928e-2d63-4412-a29c-d28bf26b5f9e

Here is the sample code i have used:

router.showResizableSheet( sheetDetents: [.medium], selection: nil, showDragIndicator: true, destination: { _ in QRCodeCapture() })

struct QRCodeCapture: View { var body: some View { VStack{ Image(systemName: "qrcode") .resizable() .frame(width: 200, height: 200) } .frame(maxWidth: .infinity, maxHeight: .infinity) .background(Color.blue) } }

bfeher commented 2 days ago

Bump. I have to manually use .sheet until this is fixed.