diff --git a/examples/issues/build.gradle.kts b/examples/issues/build.gradle.kts index c811d62670..5626aae4f3 100644 --- a/examples/issues/build.gradle.kts +++ b/examples/issues/build.gradle.kts @@ -9,10 +9,10 @@ buildscript { dependencies { // __LATEST_COMPOSE_RELEASE_VERSION__ - classpath("org.jetbrains.compose:compose-gradle-plugin:0.3.0-build135") + classpath("org.jetbrains.compose:compose-gradle-plugin:0.3.0-build146") classpath("com.android.tools.build:gradle:4.0.1") // __KOTLIN_COMPOSE_VERSION__ - classpath(kotlin("gradle-plugin", version = "1.4.21")) + classpath(kotlin("gradle-plugin", version = "1.4.21-2")) } } diff --git a/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/data/Effects.kt b/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/data/Effects.kt index 767f111416..66c8c040c7 100644 --- a/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/data/Effects.kt +++ b/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/data/Effects.kt @@ -17,7 +17,7 @@ fun uiStateFrom( ): MutableState> { val state: MutableState> = remember { mutableStateOf(UiState.Loading) } - onCommit(*inputs) { + DisposableEffect(*inputs) { state.value = UiState.Loading repositoryCall { result -> state.value = when (result) { @@ -25,6 +25,7 @@ fun uiStateFrom( is Result.Error -> UiState.Error(result.exception) } } + onDispose { } } return state diff --git a/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/view/JetIssuesView.kt b/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/view/JetIssuesView.kt index ff5a25e143..11db1761c1 100644 --- a/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/view/JetIssuesView.kt +++ b/examples/issues/common/src/jvmAndAndroidMain/kotlin/androidx/ui/examples/jetissues/view/JetIssuesView.kt @@ -18,14 +18,12 @@ import androidx.compose.foundation.* import androidx.compose.foundation.layout.* import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.* -import androidx.compose.material.Text import androidx.compose.runtime.* import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.luminance -import androidx.compose.ui.layout.WithConstraints import androidx.compose.ui.selection.DisableSelection import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.SpanStyle @@ -38,6 +36,7 @@ import androidx.ui.examples.jetissues.query.IssueQuery import androidx.ui.examples.jetissues.query.IssuesQuery import androidx.ui.examples.jetissues.query.type.OrderDirection import androidx.ui.examples.jetissues.view.common.SelectionContainer +import kotlinx.coroutines.runBlocking import org.ocpsoft.prettytime.PrettyTime import java.lang.Integer.parseInt import java.util.* @@ -59,7 +58,7 @@ fun JetIssuesView() { @Composable fun Main() { val currentIssue: MutableState = remember { mutableStateOf(null) } - WithConstraints { + BoxWithConstraints { if (maxWidth.value > 1000) { TwoColumnsLayout(currentIssue) } else { @@ -203,14 +202,18 @@ fun OrderButton(order: MutableState, scroll: ScrollState) { OrderDirection.DESC -> Button(onClick = { order.value = OrderDirection.ASC - scroll.scrollTo(0F) + runBlocking { + scroll.scrollTo(0F) + } }) { Text("ASC") } OrderDirection.ASC -> Button(onClick = { order.value = OrderDirection.DESC - scroll.scrollTo(0F) + runBlocking { + scroll.scrollTo(0F) + } }) { Text("DESC") } @@ -228,7 +231,9 @@ fun FilterTabs(issuesState: MutableState, scroll: ScrollState) { selected = issuesState.value == it, onClick = { issuesState.value = it - scroll.scrollTo(0F) + runBlocking { + scroll.scrollTo(0F) + } } ) }