https://kotlinlang.org logo
y

Yuri Drigin

02/23/2021, 12:13 PM
Why
onCommit
crashed with
Composition re quires an active composition context
?
Copy code
@Composable
fun NetworkImage(
		modifier: Modifier,
		url: String?,
		placeholder: Int
) {
		var image by remember { mutableStateOf<ImageBitmap?>(null) }

		onCommit {
				val picasso = Picasso.get()
z

Zach Klippenstein (he/him) [MOD]

02/23/2021, 3:52 PM
onCommit has been deprecated for a number of releases now - which version of Compose are you using?
y

Yuri Drigin

02/23/2021, 4:58 PM
Hmm… alpha12. And no warning about deprecated.
z

Zach Klippenstein (he/him) [MOD]

02/23/2021, 5:05 PM
Try using
SideEffect
instead - do you get the same error?
onCommit was deprecated in alpha11 - idk why it’s not marked as such in the source.
y

Yuri Drigin

02/24/2021, 7:09 AM
Yep. You was right. For my case event better
Copy code
DisposableEffect