Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lifecycle only ever emits ON_PAUSE #39

Open
John-vd-Berg opened this issue Nov 5, 2024 · 0 comments
Open

Lifecycle only ever emits ON_PAUSE #39

John-vd-Berg opened this issue Nov 5, 2024 · 0 comments

Comments

@John-vd-Berg
Copy link

John-vd-Berg commented Nov 5, 2024

When a NavHostEntry is removed from the stack it only emits the ON_PAUSE lifecycle event to observers

Consider the following code:

val lifecycleOwner = LocalLifecycleOwner.current
DisposableEffect(lifecycleOwner) {
    val observer = LifecycleEventObserver { _, event ->
        println("Event: $event")
    }

    lifecycleOwner.lifecycle.addObserver(observer)

    onDispose {
        lifecycleOwner.lifecycle.removeObserver(observer)
    }
}

I would expect to receive ON_PAUSE > ON_STOP > ON_DESTROY when the entry is removed from the stack which is not the case. It would also be nice if some docs were added about how the library works in this area

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant