Replies: 2 comments 4 replies
-
i'm experiencing the same issue. i present a screen and it immediately dismisses itself |
Beta Was this translation helpful? Give feedback.
-
A thing you have to be careful about when using SwiftUI is parent views observing too much state. If a parent is observing state that changes, it may re-compute its This behavior is observable in vanilla SwiftUI, though comes up more quickly in the Composable Architecture, where you keep all your state in one place. The problem is usually in the form of this line: WithViewStore(store) { viewStore in This In this case you can scope to just the WithViewStore(store.scope(state: \.id)) { viewStore in
VStack {
Text(viewStore.uuidString.prefix(5))
NavigationLink(
tag: viewStore.state,
selection: viewStore.binding(
get: \.first?.id,
send: AppAction.setNavigation(selection:))
) {
IfLetStore(store.scope(
state: \.first?.value,
action: AppAction.first
), then: FirstView.init(store:))
} label: {
Text("Push")
}
}
.navigationTitle("Root View")
} |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone!
How to use navigation with multiple optional page in TCA?
In the simple demo project, after clicking push button on the
First View
, theSecond View
appears and then disappears immediately.demo project
Beta Was this translation helpful? Give feedback.
All reactions