hi how can I detect if a composable is in a visibl...
# compose
r
hi how can I detect if a composable is in a visible area of the device screen?
r
You can use
Modifier.onPlaced
as it gives you a lot of layout information after the parent layout has been placed.
Copy code
Modifier.onPlaced { layoutCoordinates ->
  val (x, y) = layoutCoordinates.positionInParent()
}
in a
Row
or a
Column
layout, a positive
x
or
y
value means the composable is within the bounds of its parent. A negative value means the composable is going out of view.