Skip to content

Commit

Permalink
Instead of ignoring safe area in the bottom of the screen, add paddin…
Browse files Browse the repository at this point in the history
…g (solves danielsaidi#2)
  • Loading branch information
digitalheir committed Aug 2, 2021
1 parent ac54479 commit 7a0bb56
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Sources/BottomSheet/BottomSheet.swift
Expand Up @@ -64,13 +64,15 @@ public struct BottomSheet<Content: View>: BottomSheetView {
GeometryReader { geo in
VStack(spacing: 0) {
handle.padding()
content
// Add padding to content so that content does not go into safe area
content.padding(.bottom, geo.safeAreaInsets.bottom)
}
.frame(width: geo.size.width, height: maxHeight(in: geo), alignment: .top)
.background(style.color)
.cornerRadius(style.cornerRadius)
.modified(with: style.modifier)
.frame(height: geo.size.height, alignment: .bottom)
// Add safe area inset to frame height in order to 'overflow' to the bottom of the screen
.frame(height: geo.size.height + geo.safeAreaInsets.bottom, alignment: .bottom)
.offset(y: max(offset(for: geo) + translation, 0))
.animation(.interactiveSpring())
.gesture(
Expand All @@ -84,7 +86,7 @@ public struct BottomSheet<Content: View>: BottomSheetView {
isExpanded = value.translation.height < 0
}
)
}.edgesIgnoringSafeArea(.bottom)
}
}
}

Expand Down

0 comments on commit 7a0bb56

Please sign in to comment.