Close Menu
  • Home
  • AI
  • Big Data
  • Cloud Computing
  • iOS Development
  • IoT
  • IT/ Cybersecurity
  • Tech
    • Nanotechnology
    • Green Technology
    • Apple
    • Software Development
    • Software Engineering

Subscribe to Updates

Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

    What's Hot

    Rediscovering the Legacy of Chemist Jan Czochralski

    February 12, 2026

    Can a Flutter app sync subscription entitlements across Android and iOS?

    February 12, 2026

    The death of reactive IT: How predictive engineering will redefine cloud performance in 10 years

    February 11, 2026
    Facebook X (Twitter) Instagram
    Facebook X (Twitter) Instagram
    Big Tee Tech Hub
    • Home
    • AI
    • Big Data
    • Cloud Computing
    • iOS Development
    • IoT
    • IT/ Cybersecurity
    • Tech
      • Nanotechnology
      • Green Technology
      • Apple
      • Software Development
      • Software Engineering
    Big Tee Tech Hub
    Home»iOS Development»ios – SwiftUI List row expansion doesn’t animate smoothly; items below jump abruptly
    iOS Development

    ios – SwiftUI List row expansion doesn’t animate smoothly; items below jump abruptly

    big tee tech hubBy big tee tech hubJanuary 27, 2026022 Mins Read
    Share Facebook Twitter Pinterest Copy Link LinkedIn Tumblr Email Telegram WhatsApp
    Follow Us
    Google News Flipboard
    ios – SwiftUI List row expansion doesn’t animate smoothly; items below jump abruptly
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link


    It is generally difficult to animate a change in height for a List row smoothly. However, a possible workaround is to use a DisclosureGroup.

    When a DisclosureGroup with native styling is used in a List, it navigates quite smoothly. The way it works is actually to add a new row to the list when expanded. To use your own styling, a custom DisclosureGroupStyle can be used. By using the same technique of adding an extra row for the expanded content, the animation works quite smoothly.

    Some notes:

    • Tracking the expanded state can be handled by the DisclosureGroup.
    • The function makeBody of the custom style should return two rows when the content is expanded. This is done by not using a VStack as outer container for the content.
    • The vertical spacing for the expanded content can be reduced by applying custom .listRowInsets.
    • The list row separator above the expanded note can be hidden.
    • The alignment of the separator below the expanded note can be controlled using an .alignmentGuide.

    Here is how your example can be adapted to work this way:

    struct MyDisclosureGroupStyle: DisclosureGroupStyle {
        func makeBody(configuration: Configuration) -> some View {
            HStack(spacing: 12) {
                configuration.label
                Spacer()
                Button {
                    withAnimation {
                        configuration.isExpanded.toggle()
                    }
                } label: {
                    Image(systemName: "note.text")
                        .imageScale(.medium)
                }
                .buttonStyle(.plain)
            }
            .padding(.vertical, 8)
    
            if configuration.isExpanded {
                configuration.content
                    .listRowInsets(.init(top: 0, leading: 16, bottom: 10, trailing: 16))
                    .padding(.bottom, 8)
                    .listRowSeparator(.hidden, edges: .top)
                    .alignmentGuide(.listRowSeparatorLeading) { dim in
                        0
                    }
            }
        }
    }
    
    struct ContentView: View {
        private let items: [HistoryItem] = [
            HistoryItem(id: UUID(), title: "Client A - Morning shift", note: "Short note for entry 1."),
            HistoryItem(id: UUID(), title: "Client B - Field visit", note: "Longer note for entry 2 so the row expands more than the others."),
            HistoryItem(id: UUID(), title: "Client C - Training", note: nil),
            HistoryItem(id: UUID(), title: "Client D - Support", note: "Another note for entry 4."),
            HistoryItem(id: UUID(), title: "Client E - Wrap up", note: "Final note for entry 5.")
        ]
    
        var body: some View {
            NavigationStack {
                List {
                    ForEach(items) { item in
                        if let note = item.note {
                            DisclosureGroup {
                                Text(note)
                                    .font(.subheadline)
                                    .foregroundStyle(.secondary)
                                    .padding(10)
                                    .background(.background.secondary, in: .rect(cornerRadius: 8))
                            } label: {
                                Text(item.title)
                                    .font(.headline)
                            }
                            .disclosureGroupStyle(MyDisclosureGroupStyle())
                        } else {
                            Text(item.title)
                                .font(.headline)
                                .padding(.vertical, 8)
                        }
                    }
                }
                .listStyle(.plain)
                .navigationTitle("History")
            }
        }
    }
    

    Animation



    Source link

    abruptly animate doesnt Expansion iOS Items Jump list Row smoothly SwiftUI
    Follow on Google News Follow on Flipboard
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email Copy Link
    tonirufai
    big tee tech hub
    • Website

    Related Posts

    Can a Flutter app sync subscription entitlements across Android and iOS?

    February 12, 2026

    iOS 26, using Swift, how can I group multiple Liquid Glass buttons into a single pill view?

    February 11, 2026

    The importance of human touch in AI-driven development – Donny Wals

    February 10, 2026
    Add A Comment
    Leave A Reply Cancel Reply

    Editors Picks

    Rediscovering the Legacy of Chemist Jan Czochralski

    February 12, 2026

    Can a Flutter app sync subscription entitlements across Android and iOS?

    February 12, 2026

    The death of reactive IT: How predictive engineering will redefine cloud performance in 10 years

    February 11, 2026

    Oceanhorn 3: Legend of the Shadow Sea launches March 5 on Apple Arcade

    February 11, 2026
    About Us
    About Us

    Welcome To big tee tech hub. Big tee tech hub is a Professional seo tools Platform. Here we will provide you only interesting content, which you will like very much. We’re dedicated to providing you the best of seo tools, with a focus on dependability and tools. We’re working to turn our passion for seo tools into a booming online website. We hope you enjoy our seo tools as much as we enjoy offering them to you.

    Don't Miss!

    Rediscovering the Legacy of Chemist Jan Czochralski

    February 12, 2026

    Can a Flutter app sync subscription entitlements across Android and iOS?

    February 12, 2026

    Subscribe to Updates

    Get the latest technology news from Bigteetechhub about IT, Cybersecurity and Big Data.

      • About Us
      • Contact Us
      • Disclaimer
      • Privacy Policy
      • Terms and Conditions
      © 2026 bigteetechhub.All Right Reserved

      Type above and press Enter to search. Press Esc to cancel.