Skip to content

Commit

Permalink
Fix "Flash on page change" gives black screen on page change
Browse files Browse the repository at this point in the history
Fixes #108
  • Loading branch information
AntsyLich committed Jan 20, 2024
1 parent 78e66fd commit 38d6ab8
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import kotlinx.coroutines.delay
import kotlin.time.Duration.Companion.seconds

@Stable
class DisplayRefreshHost {
Expand All @@ -30,15 +31,15 @@ fun DisplayRefreshHost(
val currentDisplayRefresh = hostState.currentDisplayRefresh
LaunchedEffect(currentDisplayRefresh) {
if (currentDisplayRefresh) {
delay(1500)
delay(1.5.seconds)
hostState.currentDisplayRefresh = false
}
}

if (currentDisplayRefresh) {
Canvas(
modifier = modifier.fillMaxSize(),
) {
Canvas(
modifier = modifier.fillMaxSize(),
) {
if (currentDisplayRefresh) {
drawRect(Color.Black)
}
}
Expand Down

0 comments on commit 38d6ab8

Please sign in to comment.