ScrollKit is a SwiftUI SDK that adds powerful scroll features, like offset tracking and a header view that stretches & transforms as you pull down, and sticks to the top when you scroll.
MIT License
722
stars
26
forks
source link
ScrollViewWithStickyHeader doesn't pass 'showsIndicators' to ScrollViewWithOffsetTracking #13
When setting a ScrollViewWithStickyHeader's 'showsIndicators' to 'false', this value is not passed on to ScrollViewWithOffsetTracking, so it always defaults to showing indicators.
Current version:
var scrollView: some View { GeometryReader { proxy in ScrollViewWithOffsetTracking(onScroll: handleScrollOffset) { VStack(spacing: 0) { scrollHeader content() .frame(maxHeight: .infinity) } } .onAppear { DispatchQueue.main.async { navigationBarHeight = proxy.safeAreaInsets.top } } } }
Should be:
var scrollView: some View { GeometryReader { proxy in ScrollViewWithOffsetTracking(onScroll: handleScrollOffset, showsIndicators: showsIndicators) { VStack(spacing: 0) { scrollHeader content() .frame(maxHeight: .infinity) } } .onAppear { DispatchQueue.main.async { navigationBarHeight = proxy.safeAreaInsets.top } } } }
When setting a ScrollViewWithStickyHeader's 'showsIndicators' to 'false', this value is not passed on to ScrollViewWithOffsetTracking, so it always defaults to showing indicators.
Current version:
var scrollView: some View { GeometryReader { proxy in ScrollViewWithOffsetTracking(onScroll: handleScrollOffset) { VStack(spacing: 0) { scrollHeader content() .frame(maxHeight: .infinity) } } .onAppear { DispatchQueue.main.async { navigationBarHeight = proxy.safeAreaInsets.top } } } }
Should be:
var scrollView: some View { GeometryReader { proxy in ScrollViewWithOffsetTracking(onScroll: handleScrollOffset, showsIndicators: showsIndicators) { VStack(spacing: 0) { scrollHeader content() .frame(maxHeight: .infinity) } } .onAppear { DispatchQueue.main.async { navigationBarHeight = proxy.safeAreaInsets.top } } } }