From b06c3940424e66689396fa7864f220d1834cacd6 Mon Sep 17 00:00:00 2001 From: yibeomseok Date: Wed, 14 Aug 2024 16:04:44 +0900 Subject: [PATCH] Fix Prevent nav back when it's not allowed --- .../ui/interests2pane/InterestsListDetailScreen.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt index 919cb44f24..ea7f5c55b8 100644 --- a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt +++ b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/interests2pane/InterestsListDetailScreen.kt @@ -153,7 +153,11 @@ internal fun InterestsListDetailScreen( ) { topicScreen( showBackButton = !listDetailNavigator.isListPaneVisible(), - onBackClick = listDetailNavigator::navigateBack, + onBackClick = { + if(listDetailNavigator.canNavigateBack()) { + listDetailNavigator.navigateBack() + } + }, onTopicClick = ::onTopicClickShowDetailPane, ) composable(route = TOPIC_ROUTE) {