You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When Paparazzi takes a snapshot of a ComposeView, we first run a composition when attaching ComposeView to the hierarchy, then execute any pending Handler callbacks, and finally tell Layoutlib to take a snapshot which internally calls measure / draw.
If we look at AsyncImagePainter, we see they update their internal painter with Dispatchers.Main.immediate which is backed by a Handler. In the case of Column, this call to Dispatchers.Main.immediate will be queued during that initial composition and will then run when we execute pending Handler callbacks. However, with LazyColumn items are not composed until the measure pass so it can figure out how many items to render. In this case, unfortunately, we cannot force the Handler to execute any pending callbacks before drawing and so the painter misses the first draw call. If you call the gif API with the same setup, I'd imagine the 2nd frame would show the image.
I'd suggest opening an issue with Coil to expose a configuration option for that Dispatcher so you can seed Dispatchers.Unconfined which will synchronously set the painter in time for the first draw.
Description
When putting an
AsyncImage
inside aLazyColumn
, causes it not to paint.It goes away if you put it in a regular
Column
Steps to Reproduce
Expected behavior
Image gets rendered in snapshot
Additional information:
The text was updated successfully, but these errors were encountered: