Increase compose to 2023.03.00

This commit is contained in:
Oleksandr Balan
2023-03-28 18:08:30 +02:00
parent d9d550fa62
commit 15f5641637
2 changed files with 16 additions and 12 deletions

View File

@@ -4,7 +4,7 @@ buildscript {
min_sdk_version = 24
target_sdk_version = 33
compose_bom_version = "2023.01.00"
compose_bom_version = "2023.03.00"
compose_compiler_version = "1.4.2"
accompanist_version = "0.28.0"
activity_version = "1.6.1"

View File

@@ -4,6 +4,7 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.key
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
@@ -69,19 +70,22 @@ public fun PageCurl(
onTapBackward = state::prev,
)
) {
if (updatedCurrent + 1 < state.max) {
content(updatedCurrent + 1)
}
if (updatedCurrent < state.max) {
Box(Modifier.drawCurl(config, internalState.forward.value.top, internalState.forward.value.bottom)) {
content(updatedCurrent)
// Wrap in key to synchronize state updates
key(updatedCurrent, internalState.forward.value, internalState.backward.value) {
if (updatedCurrent + 1 < state.max) {
content(updatedCurrent + 1)
}
}
if (updatedCurrent > 0) {
Box(Modifier.drawCurl(config, internalState.backward.value.top, internalState.backward.value.bottom)) {
content(updatedCurrent - 1)
if (updatedCurrent < state.max) {
Box(Modifier.drawCurl(config, internalState.forward.value.top, internalState.forward.value.bottom)) {
content(updatedCurrent)
}
}
if (updatedCurrent > 0) {
Box(Modifier.drawCurl(config, internalState.backward.value.top, internalState.backward.value.bottom)) {
content(updatedCurrent - 1)
}
}
}
}