Skip to content

Commit 8a17896

Browse files
authored
Fix sticky header when headerMinHeight is set lower than safeAreaInsets.top
Merge pull request #25 from dusiema/bufgix24
2 parents c490aaf + c19ae0f commit 8a17896

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/ScrollKit/ScrollViewWithStickyHeader.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,14 @@ private extension ScrollViewWithStickyHeader {
9999

100100
var isStickyHeaderVisible: Bool {
101101
guard let headerMinHeight else { return headerVisibleRatio <= 0 }
102-
return scrollOffset.y < -headerMinHeight
102+
return scrollOffset.y < -(headerHeight - headerMinHeight)
103103
}
104104

105105
@ViewBuilder
106106
var navbarOverlay: some View {
107107
if isStickyHeaderVisible {
108108
Color.clear
109-
.frame(height: navigationBarHeight)
109+
.frame(height: headerMinHeight != nil ? nil : navigationBarHeight)
110110
.overlay(scrollHeader, alignment: .bottom)
111111
.ignoresSafeArea(edges: .top)
112112
.frame(height: headerMinHeight)

0 commit comments

Comments
 (0)