Update compose-runtime version; Update primitive mutable states to mutableState API where applicable

pull/972/head
TM 1 year ago
parent 12b56b81a0
commit 7fc67c2915

@ -32,6 +32,7 @@ import androidx.compose.material3.Surface
import androidx.compose.material3.Text import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
@ -318,7 +319,7 @@ fun NiaCatalog() {
} }
item { Text("Tabs", Modifier.padding(top = 16.dp)) } item { Text("Tabs", Modifier.padding(top = 16.dp)) }
item { item {
var selectedTabIndex by rememberSaveable { mutableStateOf(0) } var selectedTabIndex by rememberSaveable { mutableIntStateOf(0) }
val titles = listOf("Topics", "People") val titles = listOf("Topics", "People")
NiaTabRow(selectedTabIndex = selectedTabIndex) { NiaTabRow(selectedTabIndex = selectedTabIndex) {
titles.forEachIndexed { index, title -> titles.forEachIndexed { index, title ->
@ -332,7 +333,7 @@ fun NiaCatalog() {
} }
item { Text("Navigation", Modifier.padding(top = 16.dp)) } item { Text("Navigation", Modifier.padding(top = 16.dp)) }
item { item {
var selectedItem by rememberSaveable { mutableStateOf(0) } var selectedItem by rememberSaveable { mutableIntStateOf(0) }
val items = listOf("For you", "Saved", "Interests") val items = listOf("For you", "Saved", "Interests")
val icons = listOf( val icons = listOf(
NiaIcons.UpcomingBorder, NiaIcons.UpcomingBorder,

@ -35,6 +35,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable import androidx.compose.runtime.Immutable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState import androidx.compose.runtime.rememberUpdatedState
@ -205,7 +206,7 @@ fun Scrollbar(
// Used to immediately show drag feedback in the UI while the scrolling implementation // Used to immediately show drag feedback in the UI while the scrolling implementation
// catches up // catches up
var interactionThumbTravelPercent by remember { mutableStateOf(Float.NaN) } var interactionThumbTravelPercent by remember { mutableFloatStateOf(Float.NaN) }
var track by remember { mutableStateOf(ScrollbarTrack(packedValue = 0)) } var track by remember { mutableStateOf(ScrollbarTrack(packedValue = 0)) }

@ -21,7 +21,7 @@ import androidx.compose.foundation.lazy.grid.LazyGridState
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
@ -60,7 +60,7 @@ private inline fun rememberDraggableScroller(
itemsAvailable: Int, itemsAvailable: Int,
crossinline scroll: suspend (index: Int) -> Unit, crossinline scroll: suspend (index: Int) -> Unit,
): (Float) -> Unit { ): (Float) -> Unit {
var percentage by remember { mutableStateOf(Float.NaN) } var percentage by remember { mutableFloatStateOf(Float.NaN) }
val itemCount by rememberUpdatedState(itemsAvailable) val itemCount by rememberUpdatedState(itemsAvailable)
LaunchedEffect(percentage) { LaunchedEffect(percentage) {

@ -7,6 +7,7 @@ androidxAppCompat = "1.5.1"
androidxBrowser = "1.4.0" androidxBrowser = "1.4.0"
androidxComposeBom = "2023.06.01" androidxComposeBom = "2023.06.01"
androidxComposeCompiler = "1.5.0" androidxComposeCompiler = "1.5.0"
androidxComposeRuntime = "1.5.2"
androidxComposeRuntimeTracing = "1.0.0-alpha03" androidxComposeRuntimeTracing = "1.0.0-alpha03"
androidxCore = "1.9.0" androidxCore = "1.9.0"
androidxCoreSplashscreen = "1.0.0" androidxCoreSplashscreen = "1.0.0"
@ -69,7 +70,7 @@ androidx-compose-foundation-layout = { group = "androidx.compose.foundation", na
androidx-compose-material-iconsExtended = { group = "androidx.compose.material", name = "material-icons-extended" } androidx-compose-material-iconsExtended = { group = "androidx.compose.material", name = "material-icons-extended" }
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" } androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
androidx-compose-material3-windowSizeClass = { group = "androidx.compose.material3", name = "material3-window-size-class" } androidx-compose-material3-windowSizeClass = { group = "androidx.compose.material3", name = "material3-window-size-class" }
androidx-compose-runtime = { group = "androidx.compose.runtime", name = "runtime" } androidx-compose-runtime = { group = "androidx.compose.runtime", name = "runtime" , version.ref = "androidxComposeRuntime" }
androidx-compose-runtime-livedata = { group = "androidx.compose.runtime", name = "runtime-livedata" } androidx-compose-runtime-livedata = { group = "androidx.compose.runtime", name = "runtime-livedata" }
androidx-compose-runtime-tracing = { group = "androidx.compose.runtime", name = "runtime-tracing", version.ref = "androidxComposeRuntimeTracing" } androidx-compose-runtime-tracing = { group = "androidx.compose.runtime", name = "runtime-tracing", version.ref = "androidxComposeRuntimeTracing" }
androidx-compose-ui-test = { group = "androidx.compose.ui", name = "ui-test-junit4" } androidx-compose-ui-test = { group = "androidx.compose.ui", name = "ui-test-junit4" }

Loading…
Cancel
Save