From 0309b475156b9186e42155d8c0a709e4fa763869 Mon Sep 17 00:00:00 2001 From: Zeeshan Khan Date: Fri, 21 Oct 2022 13:05:44 -0500 Subject: [PATCH] fixes(mobile) back navigation issue on android (#841) --- mobile/lib/shared/views/tab_controller_page.dart | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/mobile/lib/shared/views/tab_controller_page.dart b/mobile/lib/shared/views/tab_controller_page.dart index 92d79022c..8f41963c5 100644 --- a/mobile/lib/shared/views/tab_controller_page.dart +++ b/mobile/lib/shared/views/tab_controller_page.dart @@ -24,15 +24,13 @@ class TabControllerPage extends ConsumerWidget { final appRouter = AutoRouter.of(context); return WillPopScope( onWillPop: () async { - if (tabsRouter.activeIndex == 0) { - if (!appRouter.canNavigateBack) { - appRouter.navigateBack(); - } - return appRouter.canNavigateBack; - } else { + bool atHomeTab = tabsRouter.activeIndex == 0; + if (!atHomeTab) { tabsRouter.setActiveIndex(0); + } else { + appRouter.navigateBack(); } - return false; + return atHomeTab; }, child: Scaffold( body: FadeTransition(