Thread
#compose
    Scott Kruse

    Scott Kruse

    1 year ago
    What is the best way to find out if a composable is visible on screen? Im familiar with getting window rect / running intersection logic for a view, checking View.visible, etc. Is there a different way in compose?
    dambakk

    dambakk

    11 months ago
    I think I found a kind of a solution to this. I noticed that a composable does not have a height until it is visible on the screen, like this:
    .onGloballyPositioned {
        isVisibleOnScreen = it.boundsInRoot().height > 0f
    }
    where
    isVisibleOnScreen
    is a remembered mutable state. Hope it helps!