Skip to content

Commit 1b7ce6a

Browse files
committed
fix(ui): keep BottomBar content during exit so slide-out animation is visible
The manager clears the active message immediately on close (so other screens don't re-show it), which set bottomBarMessage to null before the AnimatedContent exit transition finished. BottomBarView early-returns on a null message, so the outgoing frame rendered nothing and the bar appeared to vanish instantly instead of sliding out. Retain the last non-null message and render that during the transition so the slide-out animation is visible.
1 parent 2f27439 commit 1b7ce6a

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

ui/components/src/main/kotlin/com/getcode/ui/components/bars/BottomBarContainer.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ fun BottomBarContainer(
7373
) {
7474
val scope = rememberCoroutineScope()
7575
val bottomBarMessage by barMessages.bottomBar.collectAsStateWithLifecycle()
76+
// The manager clears the message immediately on close (see onClose) so other
77+
// screens don't re-show it. Retain the last non-null message so the exit
78+
// transition still has content to render, otherwise the bar blanks out and
79+
// the slide-out animation isn't visible.
80+
var exitingMessage by remember { mutableStateOf(bottomBarMessage) }
81+
LaunchedEffect(bottomBarMessage) {
82+
if (bottomBarMessage != null) exitingMessage = bottomBarMessage
83+
}
7684
val bottomBarVisibleState = remember(bottomBarMessage?.id) { MutableTransitionState(false) }
7785
var bottomBarMessageDismissId by remember { mutableLongStateOf(0L) }
7886
val animationScale by rememberAnimationScale()
@@ -172,7 +180,7 @@ fun BottomBarContainer(
172180
scope.launch { onClose(selection, false) }
173181
}
174182
BottomBarView(
175-
bottomBarMessage = bottomBarMessage,
183+
bottomBarMessage = exitingMessage,
176184
onShown = onShown,
177185
onClose = closeWith,
178186
onBackPressed = { closeWith(SelectedBottomBarAction(-1)) }

0 commit comments

Comments
 (0)