Created
May 23, 2023 15:45
-
-
Save UnderscoreDavidSmith/08fee46b13e38347ccfc0280a415fc64 to your computer and use it in GitHub Desktop.
Weird ScrollView bug when backgrounding during .sheet presentation
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
struct ContentView: View { | |
@State var presentSheet1:Bool = false | |
@State var presentSheet2:Bool = false | |
var body: some View { | |
ScrollView { | |
VStack { | |
Button { | |
presentSheet1 = true | |
} label: { | |
Text("1") | |
.font(Font.system(size: 32)) | |
.frame(minWidth:0, maxWidth:.infinity) | |
.background(Color.red) | |
} | |
Button { | |
presentSheet2 = true | |
} label: { | |
Text("2") | |
.font(Font.system(size: 32)) | |
.frame(minWidth:0, maxWidth:.infinity) | |
.background(Color.green) | |
} | |
Spacer() | |
}.sheet(isPresented: $presentSheet1) { | |
Color.red | |
.overlay(Text("1").font(Font.system(size: 128))) | |
}.sheet(isPresented: $presentSheet2) { | |
Color.green | |
.overlay(Text("2").font(Font.system(size: 128))) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To reproduce this bug make a basic SwiftUI iOS project and replace the default ContentView with this view, then:
Instead of the "1" button being tappable instead the top several points of the screen are completely unresponsive, around the top of the "2" button there is a tappable region, but it points to the "1" button instead.