u/Forward_Childhood450

Persistent "Jump" animation glitch in SwiftUI TabView when switching tabs. Tried everything, need help.

Hi everyone,
I'm struggling with a persistent layout/animation issue in a standard SwiftUI TabView. Every time I switch tabs, the new view doesn't just appear instantly; it seems to perform a subtle "scale 0 to 1" or "fade-in with expansion" animation. Additionally, there’s a noticeable vertical layout shift (jump) where the content (like text) appears lower for a split second and then snaps higher to its final position.

The Issue:

  1. Visual Glitch: The view seems to animate its entry even though no animations are explicitly defined.
  2. Layout Shift: Content jumps vertically after appearing. (See attached video/photos).
  3. Reproducibility: This happens even with the most basic setup (just a ZStack with a Color and Text).

I have already tried (None of these fixed it):

  1. Removing all animations: Checked for withAnimation blocks and used .animation(nil, value: selectedTab).
  2. Safe Area Modifiers: Removed all .ignoresSafeArea() modifiers. The issue persists with or without them.
  3. Custom vs Native TabBar: I initially had a custom TabBar, but I reverted to the 100% native TabView for testing. The glitch is still there.
  4. Hiding/Showing TabBar: Tried UITabBar.appearance().isHidden = true and the modern .toolbar(.hidden, for: .tabBar). No difference.
  5. Transaction blocking: Added .transaction { $0.animation = nil } to the TabView.
  6. View Hierarchy: Simplified the views to just a Color and a single Text. The text still jumps upwards after the tab is selected.
  7. NavigationStack: Added/removed NavigationStack from individual tabs to see if it was a Safe Area calculation mismatch.

The Question:
Has anyone encountered this specific "jump" in TabView? I don't want to use a custom ZStack based router because I want to keep the native TabView lifecycle. Why does a "vanilla" TabView perform this jump/scale on tab change?
Any help or deep-dive technical explanation would be much appreciated! Thanks!

Link to code:
https://pastebin.com/CL700PXf

Link to video (Slow Animations mode):
https://streamable.com/35l1fw

Link to video (Standard speed):
https://streamable.com/8vllhq

reddit.com
u/Forward_Childhood450 — 4 days ago