HomeiOS DevelopmentChecklist content material jumps down when dismissing search

Checklist content material jumps down when dismissing search


When utilizing searchable and .navigationBarDrawer(displayMode: .all the time) inside a TabView, the content material of a listing has a visual soar when cancelling search. I am working in iOS 18.

Checklist content material jumps down when dismissing search

I’ve moved modifiers in every single place, tried with ScrollView, used subviews and so forth. I can’t get this animation to behave just like the native apps. See the App Retailer, the Well being App, and the recordsdata App to see what I imply. The content material animates easily when cancelling search. How did they do it?

struct ContentView: View {
    @State personal var searchText: String = ""
    @State personal var selectedTab: Int = 0
    
    var physique: some View {
        TabView(choice: $selectedTab) {
            Tab(worth: 0, position: .search) {
                NavigationStack {
                    Checklist {
                        ForEach(0..<25, id:.self) { num in
                            Textual content("(num)")
                        }
                    }
                    .listStyle(.plain)
                    .searchable(textual content: $searchText, placement: .navigationBarDrawer(displayMode: .all the time))
                    .navigationTitle("Search")
                }
            }
        }
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments