-
Notifications
You must be signed in to change notification settings - Fork 121
Bookings: Update tab handling for booking list #16188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Generated by 🚫 Danger |
|
|
RafaelKayumov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as described. Left one question. Pre-approving.
| ZStack { | ||
| ForEach(BookingListTab.allCases, id: \.rawValue) { tab in | ||
| BookingListView(viewModel: viewModel.listViewModel(for: tab)) { | ||
| headerView | ||
| } | ||
| .opacity(viewModel.selectedTab == tab ? 1 : 0) | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please describe the reasoning behind this approach of
- injecting a header (tabs + filter bar) to each list view. When switching tabs, the header also has fade-in animation.
- switching lists by toggling the opacity.
How about keeping the header above switchable list views and using a TabView:
VStack {
headerView
TabView(selection: $viewModel.selectedTab) {
ForEach(BookingListTab.allCases, id: \.rawValue) { tab in
BookingListView(viewModel: viewModel.listViewModel(for: tab)) {
}
.tag(tab)
}
}
.tabViewStyle(.page(indexDisplayMode: .never))
}
We have other places in the app where the TabView is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
injecting a header (tabs + filter bar) to each list view. When switching tabs, the header also has fade-in animation.
Hey - this was a workaround for the refresh control in the booking list. When the list is added to a navigation view with large title, pulling down the list will also pull down the big title while the header (tab bar and filter bar) stays fixed at the top, which looks bad. Injecting the header to a section inside the scroll view and ask the LazyVStack to pin the section header helped pulling the header down as well.
switching lists by toggling the opacity.
I wanted to keep the states of the lists instead of re-rendering and loading bookings again upon switching tabs.
How about keeping the header above switchable list views and using a TabView
Thanks for the great idea! I didn't think about using TabView just for the content, and TIL about hiding the index view. Using the TabView fixes both the problems above for me: managing the tab views and keeping the refresh control under the header view, instead of above the large navigation title:
I updated the BookingListView to remove the now redundant workarounds for the header and refresh control. I also added a check to avoid loading the booking list again if it's not empty.
Please take another look when you can 🙏
RafaelKayumov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
I removed the redundant spacing in a95afcc. The view should looks good now. |




Part of WOOMOB-1392
Description
This PR updates the view of the booking list to support fetching bookings separately for Today, Upcoming, and All tabs. The idea is to add a container view to keep 3 lists with separate view models, and only show/hide them upon tab selection.
The logic for fetching bookings of each tab will be handled in a subsequent PR.
Testing steps
Testing information
Tested with simulator iPhone 17 iOS 26.
Screenshots
Simulator.Screen.Recording.-.iPhone.17.-.2025-10-01.at.15.23.05.mov
RELEASE-NOTES.txtif necessary.