I want to present modally view and after dismissing present it once again.
struct ContentView : View {
var body: some View {
NavigationView {
Group {
Text("hi")
Text("hello")
}
.navigationBarItem(title: Text("Demo"))
.navigationBarItems(trailing:
PresentationButton(
Image(systemName: "person.crop.circle")
.imageScale(.large)
.accessibility(label: Text("User Profile"))
.padding(),
destination: Text("User Profile")
)
)
}
}
}
It triggers only during first tap. After dismissing destination view the tap on PresentationButton
do nothing. Do someone have the solution for this?
It looks like a bug, here's a workaround:
struct ContentView : View {
@State var showModal: Bool = false
var body: some View {
NavigationView {
Group {
Text("hi")
Text("hello")
}
.navigationBarItem(title: Text("Demo"))
.navigationBarItems(trailing:
Button(action: {
self.showModal = true
}) {
Image(systemName: "person.crop.circle")
}
)
}.presentation(showModal ? Modal(Text("Hey"),
onDismiss: { self.showModal = false }) : nil)
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With