The regular case.
Open a sheet by clicking a button. Next close the sheet using a Cancel button on it. The isPresented state variable is changed immediately, but while the dismissing animation isn't totally finished it's impossible to click the Button on the main parent screen and call the sheet presentation again.
As I understand UIKit works differently and lets us click the Button but just calls a new modal view exactly after the previous animation is finished
struct MyView: View {
@State private var isPresented = false
public var body: some View {
VStack {
Button(action: {
isPresented = true
}, label: {
Text("Button")
})
Spacer()
}
.sheet(isPresented: $isPresented) {
sheetContent
}
}
var sheetContent: some View {
VStack {
Text("Cancel")
.onTapGesture {
isPresented = false
}
Spacer()
}
}
}
@Apple Could you please fix it in SwiftUI?
Post
Replies
Boosts
Views
Activity
To reproduce this bug:
Set the .large navigation title in a View (which is in a NavigationView)
Add the .searchable modifier
And add the .refreshable modifier over a scroll view for example
Drag the pull to refresh
Actual result:
The navigation bar is blinking and jumping to the top without smooth animation
Expected result:
Navigation bar behaves expectedly as usual
I noticed if we use the .inline navigation title style or remove the .searchable modifier it work correctly