coil-kt / coil

Image loading for Android and Compose Multiplatform.

Home Page:https://coil-kt.github.io/coil/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Since `ExecuteCallback` is not available anymore, what's the equivalent to the code below?

TonnyL opened this issue · comments

Discussed in #1312

Originally posted by TonnyL June 4, 2022

var originalImageHeight by remember { mutableStateOf(0f) } // px
var originalImageWidth by remember { mutableStateOf(0f) } // px

Image(
        painter = rememberImagePainter(
            data = url,
            builder = {
                listener(
                    onSuccess = { _, _ ->
                        isLoading = false
                    },
                    onError = { _, _ ->
                        isLoading = false
                    }
                )
            },
            onExecute = { _, current ->
                originalImageHeight = current.size.height
                originalImageWidth = current.size.width

                true
            }
        ),
    // ...
)
```</div>

Please don’t repost as an issue if your question isn’t responded to. This tracker is for bug reports - not support.