-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7e907f
commit 5b5f40d
Showing
6 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters