Skip to content
Discussion options

You must be logged in to vote

Components can't control their lifecycle - that's the parent's responsibility. On the parent's side, that depends on how child components are created.

If you are using childContext, then you can pass LifecycleRegistry there for manual control. Please also mind the pending API change - #202.

If you are using childStack, then there is no direct API of controlling the lifecycle, and it's advised not to interfere with it. But if you really need to, you can try the following:

val stackLifecycle = LifecycleRegistry()
val childStack = childContext(key = "stack", lifecycle = stackLifecycle).childStack(...)

stackLifecycle.resume()
stackLifecycle.stop()
// Never destroy the lifecycle manually!

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by YektaDev
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants