Hello guys, when using voyager for navigation, how can we listen and receive on navigation changed
not kotlin but kotlin colored 1
p
Pablichjenkov
10/12/2023, 11:02 PM
I think for a library specific question you get a better chance by opening an issue/discussion in their public repo.
s
SrSouza
10/13/2023, 1:18 AM
The Navigator it self is a SnapshotStack, you can listen to any property from navigator as a State.
SrSouza
10/13/2023, 1:19 AM
For example LaunchedEffect(navigator.lastItem) will trigger every time the top screen changes
b
brabo-hi
10/17/2023, 5:30 AM
@SrSouza thanks, on another topic, how to share a viewModel between couple screens
s
SrSouza
10/17/2023, 10:13 AM
There are some PRs to make that possible but we did not complete anything yet. In practice, what you can do is retrieving the ViewModel by using any non voyager ViewModelStoreOwner I think.
For example