Closed safarafa closed 1 year ago
Hi @safarafa, this is the expected behavior of \.dismiss
. All it does is find the closest optional state that is driving some kind of navigation and nil
s it out in order to undo the navigation. So, in your case it finds @PresentationState var child
and nil
s out the child state, causing the screen to be popped off the stack.
It's worth noting that this is exactly how @Environment(\.dismiss)
works in vanilla SwiftUI.
Since this is not an issue with the library I will convert this to a discussion. Feel free to continue discussing over there if you have more questions.
Description
Child view is shown using
@PresentationState
in parent view, and both of them are shown in hybrid application, usingUIHostingController
shown as modal in newUINavigationController
, and this whole modal view is dismissed (by UIKit method). When we'll show child view again, TCA'sdismiss
method is not working - actions are sent, the state is set to nil, but the corresponding view is still visible. It might be bug, because apparently the state is not nil after cancelling process.Sample app
Checklist
main
branch of this package.Expected behavior
Using
.dismiss()
should remove view and set state to nil.Actual behavior
Using
.dismiss()
is not removing view and the state is not nil.Steps to reproduce
The Composable Architecture version information
1.1.0 and below
Destination operating system
iOS 14
Xcode version information
14.3.1
Swift Compiler version information