ReusableComposition
-
Cmn
sealed interface ReusableComposition : Composition
PausableComposition |
A |
A ReusableComposition is a Composition that can be reused for different composable content.
This interface is used by components that have to synchronize lifecycle of parent and child compositions and efficiently reuse the nodes emitted by ReusableComposeNode.
Summary
Public functions |
||
|---|---|---|
Unit |
Deactivate all observation scopes in composition and remove all remembered slots while preserving nodes in place. |
Cmn
|
Unit |
setContentWithReuse(content: @Composable () -> Unit)Update the composition with the content described by the |
Cmn
|
Inherited functions |
||||||
|---|---|---|---|---|---|---|
|
Inherited properties |
|---|
Public functions
deactivate
fun deactivate(): Unit
Deactivate all observation scopes in composition and remove all remembered slots while preserving nodes in place. The composition can be re-activated by calling setContent with a new content.
setContentWithReuse
fun setContentWithReuse(content: @Composable () -> Unit): Unit
Update the composition with the content described by the content composable. After this has been called the changes to produce the initial composition has been calculated and applied to the composition.
This method forces this composition into "reusing" state before setting content. In reusing state, all remembered content is discarded, and nodes emitted by ReusableComposeNode are re-used for the new content. The nodes are only reused if the group structure containing the node matches new content.
Will throw an IllegalStateException if the composition has been disposed.
| Parameters | |
|---|---|
content: @Composable () -> Unit |
A composable function that describes the content of the composition. |
| Throws | |
|---|---|
kotlin.IllegalStateException |
thrown in the composition has been |