Binding for presenting partialSheet is not updated correctly when tapping fast to dismiss the sheet.
adiki opened this issue · comments
Adrian Śliwa commented
Steps to reproduce:
- Go to PSButton and replace
isPresenting.toggle()
withisPresenting = true
- Open Basic Example
- Tap Display button very fast to present and dismiss the sheet
- Actual behaviour: After a few taps you can't no longer open partial sheet
- Expected behaviour: You can present and dismiss partial sheet even when tapping very fast on the button and not rely on self recovering mechanism with
.toggle()
as the binding is not updated correctly.
Nikita Amelchenko commented
Confirming this issue! @adiki did you ever find a workaround?
Nikita Amelchenko commented
I figured out the reason is:
@Published var isPresented: Bool = false {
didSet {
if !isPresented {
DispatchQueue.main.asyncAfter(deadline: .now() + 0.35) { [weak self] in
self?.content = EmptyView().eraseToAnyView()
self?.onDismiss = nil
}
}
}
}
santiagoSoft commented
Any fix for this issue?