Skip to content

Commit

Permalink
Described LocalStackAnimationProvider in the docs
Browse files Browse the repository at this point in the history
  • Loading branch information
arkivanov authored Dec 16, 2023
1 parent 9ef5e26 commit 0801120
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/extensions/compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,24 @@ fun RootContent(component: RootComponent) {
}
```

### Default stack animations

By default, the `Children` function (and all other functions with stack animations) does not animate stack changes, the change is performed instantly. The default stack animation is configurable, so that it's possible to avoid specifying the same animation multiple times.

```kotlin
@Composable
fun App() {
CompositionLocalProvider(LocalStackAnimationProvider provides DefaultStackAnimationProvider) {
// The rest of the code
}
}

private object DefaultStackAnimationProvider : StackAnimationProvider {
override fun <C : Any, T : Any> provide(): StackAnimation<C, T> =
stackAnimation(slide() + scale())
}
```

### Custom animations

It is also possible to define custom animations.
Expand Down

0 comments on commit 0801120

Please sign in to comment.