its probably been asked before, but is there a goo...
# compose
a
its probably been asked before, but is there a good example of implementing an element in view modifier? i.e. I want to know when a composable in say a lazycolumn becomes visible to the user on screen?
o
Would this suffice?
Copy code
class DrawLoggingModifier(private val subject: String) : DrawModifier {
    override fun ContentDrawScope.draw() {
        <http://logger.info|logger.info> { "Drawing $subject" }
        drawContent()
    }
}

fun Modifier.logDrawing(subject: String) = this.then(DrawLoggingModifier(subject))
a
I don’t think so because lazy layouts pre load the content off screen. I need to know when it’s sufficiently visible on screen
o
In my recent tests using Compose Desktop the above modifier was logging visible elements only.