Skip to content

Commit

Permalink
Also use bottom safe area inset for computing height (danielsaidi#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalheir committed Aug 2, 2021
1 parent 66401a5 commit 7b6101c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sources/BottomSheet/BottomSheet.swift
Expand Up @@ -94,8 +94,8 @@ private extension BottomSheet {

func height(of height: BottomSheetHeight, in geo: GeometryProxy) -> CGFloat {
switch height {
case .available: return geo.size.height
case .percentage(let ratio): return ratio * geo.size.height
case .available: return geo.size.height + geo.safeAreaInsets.bottom
case .percentage(let ratio): return ratio * (geo.size.height + geo.safeAreaInsets.bottom)
case .points(let points): return points
}
}
Expand Down Expand Up @@ -155,7 +155,7 @@ struct BottomSheet_Previews: PreviewProvider {
//
// ScrollView
if #available(iOS 14.0, *) {
BottomSheet(isExpanded: .constant(true), maxHeight: .percentage(0.6)) {
BottomSheet(isExpanded: .constant(true), maxHeight: .available) {
ScrollViewReader { scroll in
ScrollView {
twentyItems.onAppear {
Expand All @@ -167,7 +167,7 @@ struct BottomSheet_Previews: PreviewProvider {
}
}
}
BottomSheet(isExpanded: .constant(true), maxHeight: .percentage(0.6)) {
BottomSheet(isExpanded: .constant(true), maxHeight: .percentage(1)) {
ScrollView {
twentyItems
}
Expand Down

0 comments on commit 7b6101c

Please sign in to comment.