Skip to content

Instantly share code, notes, and snippets.

@mutkuensert
Created January 19, 2026 14:44
Show Gist options
  • Select an option

  • Save mutkuensert/36cb2f4e7e54664a67ea8e3c58afaf68 to your computer and use it in GitHub Desktop.

Select an option

Save mutkuensert/36cb2f4e7e54664a67ea8e3c58afaf68 to your computer and use it in GitHub Desktop.
A composable that indicates to the user there is a scrollable content
@Composable
fun ScrollHintEffect(content: @Composable (scrollState: ScrollState) -> Unit) {
var hasHinted by rememberSaveable { mutableStateOf(false) }
val density = LocalDensity.current
val scrollState = rememberScrollState()
LaunchedEffect(Unit) {
delay(300)
if (!hasHinted) {
hasHinted = true
repeat(2) {
scrollState.animateScrollBy(
value = with(density) { 32.dp.toPx() },
animationSpec = tween()
)
scrollState.animateScrollBy(
value = -with(density) { 32.dp.toPx() },
animationSpec = tween()
)
}
}
}
content.invoke(scrollState)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment