Replies: 1 comment
-
I changed the code to bellow, it works. 😅 (I don't know why.) CaseLet(state: /AppState.login, action: AppAction.login) { store in
- NavigationView {
- LoginView(store: store)
- }
- .navigationViewStyle(.stack)
+ LoginView(store: store)
} struct LoginView: View {
let store: Store<LoginState, LoginAction>
var body: some View {
WithViewStore(store) { viewStore in
- Text("Login")
+ NavigationView {
+ Text("Login")
+ }
+ .navigationViewStyle(.stack)
.sheet(
isPresented: viewStore.binding(
get: \.isTwoFactorPresented,
send: .twoFactorDismissed
)
) {
IfLetStore(store.scope(state: \.twoFactor)) { _ in
Button(action: { viewStore.send(.twoFactorDoneButtonTapped) }) {
Text("Two Factor Done")
}
}
}
}
}
} Simulator.Screen.Recording.-.iPod.touch.7th.generation.-.2022-01-16.at.17.31.14.mp4Maybe, do we need to show sheets in NavigationView? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
If a parent View changes while a sheet is displayed, the sheet will still be displayed.
How can I tell SwiftUI to dismiss the sheet?
My problem is:
.twoFactorDoneButtonTapped
received.Simulator.Screen.Recording.-.iPod.touch.7th.generation.-.2022-01-16.at.15.40.30.mp4
I think this problem is not limited to TCA, but to SwiftUI in general. Does anyone have an idea to solve this problem?
In this example, the parent View is changed as a result of pressing a button (
Two Factor Done
), but the same problem occurs in situations such as forcing the user to log out due to global error handling, universal link, etc.Beta Was this translation helpful? Give feedback.
All reactions