Kwik View Visibility Tracker
fun KwikViewVisibilityTracker(modifier: Modifier = Modifier, tolerance: Int = 0, onVisibilityChanged: (isVisible: Boolean) -> Unit, content: @Composable () -> Unit)
This component tracks the visibility of the content inside it. and notifies the caller when the visibility changes. The caller can provide a tolerance value to adjust the visibility. For example, if the caller wants to know when the content is 50% visible on the screen,
Parameters
modifier
: Modifier - The modifier for the component
tolerance
: Int - The tolerance value to adjust the visibility
on Visibility Changed
: (isVisible: Boolean) -> Unit - The callback to notify the caller when the visibility changes
content
: @Composable () -> Unit - The content to display and track visibility
Example usage:
KwikViewVisibilityTracker(
tolerance = 0,
onVisibilityChanged = { isVisible ->
// Do something when the content is visible
}
){
// Content to track visibility for
}
Content copied to clipboard