Preserving Tab State on Switch
Keep each tab's scroll and state.
The Lost Scroll Problem
By default, leaving a tab and coming back rebuilds it from scratch, so your scroll position and inputs vanish. Annoying, right? 😅
Why It Happens
A plain navigate replaces the destination, so Compose forgets the old screen. Preserving state means telling navigation to save it instead.
All lessons in this course
- NavigationBar with Multiple Tabs
- Highlighting the Selected Route
- Preserving Tab State on Switch
- TabRow & Swipeable Pages