Skip to content

Commit

Permalink
Fix BottomSheetShell to accurately draws scrim over system bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth Agarwal committed Jun 3, 2024
1 parent 59779d1 commit 45e0a83
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package org.hisp.dhis.mobile.ui.designsystem.component

import org.hisp.dhis.mobile.ui.designsystem.theme.Color as ThemeColor
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.ScrollableState
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredHeight
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
Expand All @@ -35,7 +35,6 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.launch
import org.hisp.dhis.mobile.ui.designsystem.component.internal.bottomSheet.rememberDimensionByName
import org.hisp.dhis.mobile.ui.designsystem.theme.Border
import org.hisp.dhis.mobile.ui.designsystem.theme.InternalSizeValues
import org.hisp.dhis.mobile.ui.designsystem.theme.Shape
Expand All @@ -45,7 +44,6 @@ import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing.Spacing24
import org.hisp.dhis.mobile.ui.designsystem.theme.Spacing.Spacing8
import org.hisp.dhis.mobile.ui.designsystem.theme.SurfaceColor
import org.hisp.dhis.mobile.ui.designsystem.theme.TextColor
import org.hisp.dhis.mobile.ui.designsystem.theme.Color as ThemeColor

/**
* DHIS2 [BottomSheetHeader] component designed to be used
Expand Down Expand Up @@ -162,10 +160,6 @@ fun BottomSheetShell(
) {
val sheetState = rememberModalBottomSheetState(true)
val scope = rememberCoroutineScope()
// TODO - hack to get navigation bar padding does not take into account IME padding (reflection)
// TODO - Should be remove when google publish https://issuetracker.google.com/issues/274872542
val topInsets = WindowInsets(top = rememberDimensionByName("status_bar_height"))
val bottomInsets = WindowInsets(bottom = rememberDimensionByName("navigation_bar_height"))

ModalBottomSheet(
modifier = modifier,
Expand Down Expand Up @@ -195,13 +189,11 @@ fun BottomSheetShell(
}
}
},
windowInsets = topInsets,
) {
val canScrollForward by derivedStateOf { contentScrollState.canScrollForward }

Column(
modifier = Modifier
.padding(bottomInsets.asPaddingValues()),
modifier = Modifier.systemBarsPadding()
) {
Column(
modifier = Modifier
Expand Down

0 comments on commit 45e0a83

Please sign in to comment.