mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Fix "Flash on page change" gives black screen on page change
Fixes #108
This commit is contained in:
parent
78e66fd8d3
commit
38d6ab80ce
1 changed files with 6 additions and 5 deletions
|
@ -11,6 +11,7 @@ import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
|
import kotlin.time.Duration.Companion.seconds
|
||||||
|
|
||||||
@Stable
|
@Stable
|
||||||
class DisplayRefreshHost {
|
class DisplayRefreshHost {
|
||||||
|
@ -30,15 +31,15 @@ fun DisplayRefreshHost(
|
||||||
val currentDisplayRefresh = hostState.currentDisplayRefresh
|
val currentDisplayRefresh = hostState.currentDisplayRefresh
|
||||||
LaunchedEffect(currentDisplayRefresh) {
|
LaunchedEffect(currentDisplayRefresh) {
|
||||||
if (currentDisplayRefresh) {
|
if (currentDisplayRefresh) {
|
||||||
delay(1500)
|
delay(1.5.seconds)
|
||||||
hostState.currentDisplayRefresh = false
|
hostState.currentDisplayRefresh = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentDisplayRefresh) {
|
Canvas(
|
||||||
Canvas(
|
modifier = modifier.fillMaxSize(),
|
||||||
modifier = modifier.fillMaxSize(),
|
) {
|
||||||
) {
|
if (currentDisplayRefresh) {
|
||||||
drawRect(Color.Black)
|
drawRect(Color.Black)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue