mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-09-20 18:50:00 +00:00
1bf4d9e398
* - *WIP* Explore tab: Tap on tab to scroll to top. * - Explore tab: Tap tab to scroll to top. * - Explore: Tap tab again to focus on search bar. - Explore: Set `.defaultMinListRowHeight` so scroll to view doesn't occupy more than 1pt height in grouped style list. - Explore: Add padding to get Explore list view to look the same. * - Explore: Minor adjust to padding. * - Messages: Add tap tab to scroll to top. * - Notifications: Add tap tab to scroll to top. * - Profile: Add tap tab to scroll to top. * Add `ScrollToView` that can be used across all views. * Move scroll-to-top constants to ScrollToView. * Format --------- Co-authored-by: Thomas Ricouard <ricouard77@gmail.com>
21 lines
614 B
Swift
21 lines
614 B
Swift
import SwiftUI
|
|
|
|
/// Add to any `ScrollView` or `List` to enable scroll-to behaviour (e.g. useful for scroll-to-top).
|
|
///
|
|
/// This view is configured such that `.onAppear` and `.onDisappear` are called while remaining invisible to users on-screen.
|
|
public struct ScrollToView: View {
|
|
public enum Constants {
|
|
public static let scrollToTop = "top"
|
|
}
|
|
|
|
public init() {}
|
|
|
|
public var body: some View {
|
|
HStack { SwiftUI.EmptyView() }
|
|
.listRowBackground(Color.clear)
|
|
.listRowSeparator(.hidden)
|
|
.listRowInsets(.init())
|
|
.accessibilityHidden(true)
|
|
.id(Constants.scrollToTop)
|
|
}
|
|
}
|