Gil Goldzweig
05/28/2019, 5:25 AMmatvei
05/28/2019, 6:46 PM@Composable
fun UserRow(userId: Int) {
val user = +state<User?> { null }
+onActive {
val dispose = Api.getUserAsync(userId) { user.value = it }
onDispose { dispose() }
}
if (user.value == null) {
LoadingIndicator()
} else {
Row {
Image(src = user.value.profileImage)
Text(text = user.value.name)
}
}
}
the final APIs is still TBD, but that's what we have right nowfun LoggedText(text: string) {
+onDispose { Log.i(TAG, "text leaves composition") }
Text(text)
}
Gil Goldzweig
05/29/2019, 3:22 AM