@@ -52,21 +52,25 @@ public struct BottomSheet<Content: View>: View {
5252
5353public var body : some View {
5454GeometryReader { geometryin
55- ZStack {
56- self . fullScreenLightGrayOverlay ( )
57- VStack ( spacing: 0 ) {
58- self . topBar ( geometry: geometry)
59- VStack ( spacing: - 8 ) {
60- Spacer ( )
61- self . content. padding ( . bottom, geometry. safeAreaInsets. bottom)
62- Spacer ( )
55+ if geometry. size!= . zero{
56+ ZStack {
57+ self . fullScreenLightGrayOverlay ( )
58+ VStack ( spacing: 0 ) {
59+ self . topBar ( geometry: geometry)
60+ VStack ( spacing: - 8 ) {
61+ Spacer ( )
62+ self . content. padding ( . bottom, geometry. safeAreaInsets. bottom)
63+ Spacer ( )
64+ }
6365}
66+ . frame ( height: sheetHeight ( in: geometry) - min( self . draggedOffset*2, 0 ) )
67+ . background ( self . contentBackgroundColor)
68+ . cornerRadius ( self . topBarCornerRadius, corners: [ . topLeft, . topRight] )
69+ . animation ( . interactiveSpring( ) )
70+ . offset ( y: self . isPresented? ( geometry. size. height/ 2 - sheetHeight( in: geometry) / 2 + geometry. safeAreaInsets. bottom+ self . draggedOffset) : ( geometry. size. height/ 2 + sheetHeight( in: geometry) / 2 + geometry. safeAreaInsets. bottom) )
6471}
65- . frame ( height: sheetHeight ( in: geometry) - min( self . draggedOffset*2, 0 ) )
66- . background ( self . contentBackgroundColor)
67- . cornerRadius ( self . topBarCornerRadius, corners: [ . topLeft, . topRight] )
68- . animation ( . interactiveSpring( ) )
69- . offset ( y: self . isPresented? ( geometry. size. height/ 2 - sheetHeight( in: geometry) / 2 + geometry. safeAreaInsets. bottom+ self . draggedOffset) : ( geometry. size. height/ 2 + sheetHeight( in: geometry) / 2 + geometry. safeAreaInsets. bottom) )
72+ } else {
73+ EmptyView ( )
7074}
7175}
7276}