Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix light/dark theme issue on bottom sheet #144

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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