From 864ca679cea35c0ae0c66e0c2895507826288e8b Mon Sep 17 00:00:00 2001 From: Yusuf Suleman Date: Sat, 4 Apr 2026 14:37:37 -0500 Subject: [PATCH] fix: remove .zoom transition causing trip card disappearance on back ROOT CAUSE: .navigationTransition(.zoom) + .matchedTransitionSource in a paged TabView. When navigating back, the zoom tries to animate to the source card, but the TabView may have recycled/repositioned the page. The animation targets a stale frame, causing the card to flash black or disappear. FIX: Removed .zoom transitions and .matchedTransitionSource from both UpcomingTripsPageView and PastTripsSection. Standard push/pop navigation is stable with paged TabViews. Also removed all debug logging. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../Features/Trips/ViewModels/TripsViewModel.swift | 10 ++-------- .../Features/Trips/Views/PastTripsSection.swift | 5 ----- .../Platform/Features/Trips/Views/TripsHomeView.swift | 10 +--------- .../Features/Trips/Views/UpcomingTripsPageView.swift | 8 -------- 4 files changed, 3 insertions(+), 30 deletions(-) diff --git a/ios/Platform/Platform/Features/Trips/ViewModels/TripsViewModel.swift b/ios/Platform/Platform/Features/Trips/ViewModels/TripsViewModel.swift index 392ec63..8192006 100644 --- a/ios/Platform/Platform/Features/Trips/ViewModels/TripsViewModel.swift +++ b/ios/Platform/Platform/Features/Trips/ViewModels/TripsViewModel.swift @@ -27,11 +27,8 @@ final class TripsViewModel { error = nil do { - let fetched = try await api.getTrips() - print("[TRIPS] loadTrips: fetched \(fetched.count) trips") - trips = fetched + trips = try await api.getTrips() } catch { - print("[TRIPS] loadTrips ERROR: \(error)") self.error = error.localizedDescription } isLoading = false @@ -40,11 +37,8 @@ final class TripsViewModel { func refresh() async { isLoading = true do { - let fetched = try await api.getTrips() - print("[TRIPS] refresh: fetched \(fetched.count) trips") - trips = fetched + trips = try await api.getTrips() } catch { - print("[TRIPS] refresh ERROR: \(error)") self.error = error.localizedDescription } isLoading = false diff --git a/ios/Platform/Platform/Features/Trips/Views/PastTripsSection.swift b/ios/Platform/Platform/Features/Trips/Views/PastTripsSection.swift index 7c91850..0776a1a 100644 --- a/ios/Platform/Platform/Features/Trips/Views/PastTripsSection.swift +++ b/ios/Platform/Platform/Features/Trips/Views/PastTripsSection.swift @@ -4,10 +4,8 @@ import SwiftUI /// Adapted from Apple's Wishlist TripCollectionView. struct PastTripsSection: View { let trips: [Trip] - let namespace: Namespace.ID var body: some View { - let _ = { print("[TRIPS] PastTripsSection body — trips=\(trips.count) ids=\(trips.map(\.id))") }() if !trips.isEmpty { Section { ScrollView(.horizontal) { @@ -15,11 +13,8 @@ struct PastTripsSection: View { ForEach(trips) { trip in NavigationLink { TripPlaceholderView(trip: trip) - .navigationTransition( - .zoom(sourceID: trip.id, in: namespace)) } label: { TripCard(trip: trip, size: .compact) - .matchedTransitionSource(id: trip.id, in: namespace) .contentShape(.rect) } .buttonStyle(.plain) diff --git a/ios/Platform/Platform/Features/Trips/Views/TripsHomeView.swift b/ios/Platform/Platform/Features/Trips/Views/TripsHomeView.swift index 8336ce4..7e06b0d 100644 --- a/ios/Platform/Platform/Features/Trips/Views/TripsHomeView.swift +++ b/ios/Platform/Platform/Features/Trips/Views/TripsHomeView.swift @@ -10,8 +10,6 @@ import SwiftUI struct TripsHomeView: View { @State private var vm = TripsViewModel() - @Namespace private var namespace - var body: some View { NavigationStack { Group { @@ -26,7 +24,7 @@ struct TripsHomeView: View { .padding(.bottom, 20) // Secondary: past trips (horizontal scroll, compact cards) - PastTripsSection(trips: vm.pastTrips, namespace: namespace) + PastTripsSection(trips: vm.pastTrips) } } .contentMargins(.bottom, 30, for: .scrollContent) @@ -37,12 +35,6 @@ struct TripsHomeView: View { } } .background(Color.canvas) - .onAppear { - print("[TRIPS] TripsHomeView onAppear — trips=\(vm.trips.count) upcoming=\(vm.upcomingTrips.count) past=\(vm.pastTrips.count) isLoading=\(vm.isLoading)") - } - .onChange(of: vm.trips.count) { old, new in - print("[TRIPS] trips count changed \(old) → \(new)") - } .toolbar { // Custom expanded title — Wishlist pattern ToolbarItem(placement: .title) { diff --git a/ios/Platform/Platform/Features/Trips/Views/UpcomingTripsPageView.swift b/ios/Platform/Platform/Features/Trips/Views/UpcomingTripsPageView.swift index 43b8ae0..62590a2 100644 --- a/ios/Platform/Platform/Features/Trips/Views/UpcomingTripsPageView.swift +++ b/ios/Platform/Platform/Features/Trips/Views/UpcomingTripsPageView.swift @@ -5,10 +5,7 @@ import SwiftUI struct UpcomingTripsPageView: View { let trips: [Trip] - @Namespace private var namespace - var body: some View { - let _ = { print("[TRIPS] UpcomingTripsPageView body — trips=\(trips.count) ids=\(trips.map(\.id))") }() if trips.isEmpty { // No upcoming trips — show a prompt VStack(spacing: 16) { @@ -29,10 +26,6 @@ struct UpcomingTripsPageView: View { ForEach(trips) { trip in NavigationLink { TripPlaceholderView(trip: trip) - .navigationTransition( - .zoom(sourceID: trip.id, in: namespace)) - .onAppear { print("[TRIPS] detail onAppear: \(trip.name)") } - .onDisappear { print("[TRIPS] detail onDisappear: \(trip.name)") } } label: { TripImageView(url: trip.imageURL, fallbackName: trip.name) .overlay(alignment: .bottomLeading) { @@ -55,7 +48,6 @@ struct UpcomingTripsPageView: View { .padding(.horizontal) .padding(.bottom, 54) } - .matchedTransitionSource(id: trip.id, in: namespace) } .buttonStyle(.plain) }