Skip to content

Commit

Permalink
Fix light/dark theme issue on bottom sheet
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedRejeb committed Aug 7, 2024
1 parent 0b8ca62 commit fb58dfe
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ import androidx.compose.material3.SheetValue
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.InternalComposeApi
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.currentCompositionLocalContext
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.runtime.setValue
import androidx.compose.runtime.withFrameMillis
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.interop.LocalUIViewController
import androidx.compose.ui.unit.Dp

@OptIn(ExperimentalMaterial3Api::class)
Expand All @@ -36,7 +39,7 @@ actual fun AdaptiveBottomSheet(
windowInsets: WindowInsets,
content: @Composable() (ColumnScope.() -> Unit)
) {
val compositionLocalContext = currentCompositionLocalContext
val compositionLocalContext = rememberUpdatedState(currentCompositionLocalContext)
val currentUIViewController = LocalUIViewController.current

val isDark = isSystemInDarkTheme()
Expand All @@ -51,7 +54,7 @@ actual fun AdaptiveBottomSheet(
content = {
val sheetCompositionLocalContext = currentCompositionLocalContext

CompositionLocalProvider(compositionLocalContext) {
CompositionLocalProvider(compositionLocalContext.value) {
CompositionLocalProvider(sheetCompositionLocalContext) {
if (!adaptiveSheetState.skipPartiallyExpanded) {
var update by remember { mutableIntStateOf(0) }
Expand Down

0 comments on commit fb58dfe

Please sign in to comment.