Skip to content

Commit

Permalink
Fix 'Swipe right to navigate back' to go back multiple times (#1660)
Browse files Browse the repository at this point in the history
  • Loading branch information
MV-GH authored Sep 9, 2024
1 parent 7f1ea11 commit ea157be
Showing 1 changed file with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,19 @@ fun SwipeToNavigateBack(
content: @Composable () -> Unit,
) {
if (useSwipeBack == PostNavigationGestureMode.SwipeRight) {
SwipeToDismissBox(
state = rememberSwipeToDismissBoxState(
confirmValueChange = {
when (it) {
SwipeToDismissBoxValue.StartToEnd -> {
onSwipeBack()
true
}
val swipeState = rememberSwipeToDismissBoxState()

when (swipeState.currentValue) {
SwipeToDismissBoxValue.StartToEnd -> {
onSwipeBack()
}

else -> false
}
},
positionalThreshold = { it * 0.7f },
),
else -> {
}
}

SwipeToDismissBox(
state = swipeState,
enableDismissFromEndToStart = false,
backgroundContent = {
Box(
Expand Down

0 comments on commit ea157be

Please sign in to comment.