import SwiftUI
import CodeScanner
struct Example: View {
@State private var showQr = false
var body: some View {
NavigationView {
VStack {
NavigationLink(destination: QR(), isActive: $showQr) { Text("Click me") }
}
}.navigationViewStyle(StackNavigationViewStyle())
}
}
struct QR: View {
var body: some View {
CodeScannerView(
codeTypes: [.qr],
completion: {result in }
)
}
}
If you click on Click me and then immediately press Back (this might require a couple of tries to reproduce) then suddenly nothing happens after clicking on Click Me, so the app needs to be restarted.
I noticed that I cannot reproduce this behaviour if I remove either isActive from NagivationLink or .navigationViewStyle(StackNavigationViewStyle()).
I believe it's some kind of race happening and also I think I've had bigger chance to reproduce it, because I have iPhone 7 which is slower than newer ones.
I've tried to apply changes mentioned in #31 by @breyed and it fixed the issue on my side.
Here is the example:
If you click on
Click me
and then immediately pressBack
(this might require a couple of tries to reproduce) then suddenly nothing happens after clicking onClick Me
, so the app needs to be restarted.I noticed that I cannot reproduce this behaviour if I remove either
isActive
fromNagivationLink
or.navigationViewStyle(StackNavigationViewStyle())
.I believe it's some kind of race happening and also I think I've had bigger chance to reproduce it, because I have iPhone 7 which is slower than newer ones.
I've tried to apply changes mentioned in #31 by @breyed and it fixed the issue on my side.