View disappear action is not triggered when the view is disappeared #3520
Replies: 2 comments
-
Hi @johnqiang-cao, this is to be expected, and there is even a purple runtime displaying in Xcode letting you know what you are doing isn't correct:
You cannot send an action in the What is it you are wanting to do in the If you really need to do this, you can always add it inside the } destination: { destination in
switch destination.case {
case .child(let childStore):
ChildView(store: childStore)
.onDisappear { store.send(.onChildDisappear…) }
}
} Since this isn't an issue with the library I am going to convert it to a discussion. Please feel free to continue the conversation over there! |
Beta Was this translation helpful? Give feedback.
-
Hi @mbrandonw , thanks for response.
In Reducer body, we have action:
When the Child view is unloaded, from ChildView's .onDisappear, call I do not think I can move them up to navigationDestination (with .onChildDisappear) since Previously, above . Any suggestion? Thanks. |
Beta Was this translation helpful? Give feedback.
-
Description
We have code in the view:
.onDisappear {
store.send(.viewDisappeared)
}
But viewDisappeared action is not triggered when the view is unloaded.
Checklist
main
branch of this package.Expected behavior
The .viewDisappeared action should be triggered.
Actual behavior
The .viewDisappeared action is not triggered.
Reproducing project
ResourceCleanup 2.zip
The Composable Architecture version information
1.16.1
Destination operating system
iOS 18
Xcode version information
XCode 16.1
Swift Compiler version information
No response
Beta Was this translation helpful? Give feedback.
All reactions