Skip to content

Commit

Permalink
Add FB13705157
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeElsham committed Apr 2, 2024
1 parent c7e907f commit 5b5f40d
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 0 deletions.
34 changes: 34 additions & 0 deletions FB13705157/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Sheet background flashes when changing detents

## Basic Information
### Which platform is most relevant for your report?
iOS

### Which technology does your report involve?
SwiftUI

### What type of feedback are you reporting?
Incorrect/Unexpected Behavior

### What build does the issue occur on?
iOS 17.4 Seed 3 (21E5200d)

### Where does the issue occur?
On device

## Description
- Run the given code.
- Drag the sheet up and down.
- Notice that the background of the sheet flashes, when the background is partially transparent.
- I would expect the background of the sheet not to flash.
- Moving the `SheetView` into `ContentView` seems to reduce the _chances_ of it happening, but doesn't solve the problem.
- Can use [SwiftUIIntrospect](https://github.com/siteline/swiftui-introspect) as a workaround.

## Evidence
### GIFs
| Demo | Workaround |
|:-:|:-:|
| ![Demo GIF](demo.gif) | ![Workaround GIF](workaround.gif) |

### Code
TODO
Binary file added FB13705157/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 30 additions & 0 deletions FB13705157/demo.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import SwiftUI

struct ContentView: View {
@State private var presented = true

var body: some View {
Button("Present") {
presented = true
}
.sheet(isPresented: $presented) {
SheetView()
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.red)
}
}

struct SheetView: View {
@State private var detent: PresentationDetent = .medium

var body: some View {
Text("Sheet")
.presentationBackground(.regularMaterial)
.presentationDetents([.medium, .large], selection: $detent)
}
}

#Preview {
ContentView()
}
Binary file added FB13705157/workaround.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions FB13705157/workaround.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import SwiftUI
import SwiftUIIntrospect

struct ContentView: View {
@State private var presented = true

var body: some View {
Button("Present") {
presented = true
}
.sheet(isPresented: $presented) {
SheetView()
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.red)
}
}

struct SheetView: View {
@State private var detent: PresentationDetent = .medium

var body: some View {
Text("Sheet")
.presentationBackground(.regularMaterial)
.presentationDetents([.medium, .large], selection: $detent)
.introspect(.sheet, on: .iOS(.v17)) { sheet in
sheet.presentedViewController.view.backgroundColor = .clear
}
}
}

#Preview {
ContentView()
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ These are the feedbacks I'm filing to Apple, to document bugs I come across. The

## Feedbacks
- [FB13705098](FB13705098): Sheet background doesn't reach bottom when programmatically changing detent
- [FB13705157](FB13705157): Sheet background flashes when changing detents

## Contributing
Since this is a list of my feedbacks, please don't add entirely new feedbacks. However, if you have found a workaround not already mentioned, please create an issue with your working code. If the workaround makes use of external packages such as [SwiftUIIntrospect](https://github.com/siteline/swiftui-introspect), make that clear.

0 comments on commit 5b5f40d

Please sign in to comment.