From 9909b89e5cd52da3b7c3fec030f4d368ba31ce33 Mon Sep 17 00:00:00 2001 From: andreykovalev Date: Wed, 8 May 2024 10:03:58 +0100 Subject: [PATCH] Add withMovableContent param to docs --- documentation/ui/transitions.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/documentation/ui/transitions.md b/documentation/ui/transitions.md index 92d16ba63..09c32a186 100644 --- a/documentation/ui/transitions.md +++ b/documentation/ui/transitions.md @@ -104,7 +104,8 @@ composed once design and is moved from one part of the composition to another. To move content between two Child Nodes you need to use `localMovableContentWithTargetVisibility` composable function with the correct key to retrieve existing content if it exists or put content -for this key if it doesn't exist. +for this key if it doesn't exist. In addition to that, on Parent's `Children` composable you need to +set `withMovableContent` to true. In the example below when a NodeOne is being replaced with NodeTwo in a BackStack or Spotlight NavModel `CustomMovableContent("movableContentKey")` will be moved from NodeOne to NodeTwo without losing its @@ -139,6 +140,15 @@ override fun View(modifier: Modifier) { CustomMovableContent("movableContentKey") } +// ParentNode +@Composable +override fun View(modifier: Modifier) { + Children( + navModel = backStack, + withMovableContent = true, + ) +} + ``` ## Jetpack Compose default animations