Skip to content

Commit

Permalink
Merge pull request #44 from skiptools/tabback
Browse files Browse the repository at this point in the history
Fix broken interaction between TabView and system back button
  • Loading branch information
aabewhite authored Sep 7, 2024
2 parents a383a61 + 24a0751 commit fe1b87d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Sources/SkipUI/SkipUI/Containers/TabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,10 @@ public struct TabView : View {

private func navigate(controller navController: NavHostController, route: String) {
navController.navigate(route) {
popUpTo(navController.graph.startDestinationId) {
// Clear back stack so that tabs don't participate in Android system back button
let destinationID = navController.currentBackStackEntry?.destination?.id ?? navController.graph.startDestinationId
popUpTo(destinationID) {
inclusive = true
saveState = true
}
// Avoid multiple copies of the same destination when reselecting the same item
Expand Down

0 comments on commit fe1b87d

Please sign in to comment.