Environment:
-
Ionic React with Capacitor 6
-
Navigation from login page to home page with tabs
Problem Description
I’m experiencing navigation issues when transitioning from my login page to the main app with tabs. I’ve tried multiple approaches but each creates different problems:
Issue 1: Using useIonRouter
When navigating from login to home using useIonRouter, the app successfully navigates but all tabs disappear until the app is manually reloaded. The content loads correctly, but the tab bar is completely hidden.
Issue 2: Following Official Documentation
I refactored my routing to match the exact structure shown in the Ionic React documentation, but this caused the opposite problem:
-
Only the login route works initially
-
After login, only the tab bar shows up (no content)
-
Other routes fail to load properly
Issue 3: Manual Page Reload Workaround
As a temporary fix, I tried using window.location.href to manually reload the page after login, but this approach:
-
Creates race condition issues with authentication state
-
Feels clunky and non-native
-
Causes flickering/loading states
Questions
-
Has anyone experienced similar tab visibility issues when navigating from a standalone page to a tabbed layout in Ionic React + Capacitor 6?
-
Are there known best practices for handling authentication flow transitions to tabbed interfaces?
-
Could this be related to how the routing is structured or a timing issue with component mounting?
Code Structure (High Level)
-
Login page: Standalone route outside tab structure
-
Home/Main app: Tabbed interface with multiple tab routes
-
Authentication: Context-based state management
Any insights or similar experiences would be greatly appreciated! I’m happy to share specific code snippets if that would help diagnose the issue.