We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6103d3a commit 6c22413Copy full SHA for 6c22413
docs/lifecycle.md
@@ -2,7 +2,8 @@
2
3
** Experimental API
4
5
-Inside a `Screen`, you can call `LifecycleEffectOnce` to execute a block of code the first time the Screen appears:
+Inside a `Screen`, you can call `LifecycleEffectOnce` to execute a block of code the first time the Screen appears,
6
+and optionally define a `onDispose` callback for when the Screen is leaving/removed from the Stack:
7
8
```kotlin
9
class PostListScreen : Screen {
@@ -11,6 +12,9 @@ class PostListScreen : Screen {
11
12
override fun Content() {
13
LifecycleEffectOnce {
14
screenModel.initSomething()
15
+ onDispose {
16
+ // Do something when the screen is leaving/removed from the Stack
17
+ }
18
}
19
20
// ...
0 commit comments