Answers for "jetpack compose viewpager reacting to page changes"

0

jetpack compose viewpager reacting to page changes

val pagerState = rememberPagerState()

LaunchedEffect(pagerState) {
    // Collect from the a snapshotFlow reading the currentPage
    snapshotFlow { pagerState.currentPage }.collect { page ->
        AnalyticsService.sendPageSelectedEvent(page)
    }
}

VerticalPager(
    count = 10,
    state = pagerState,
) { page ->
    Text(text = "Page: $page")
}
Posted by: Guest on October-03-2021

Code answers related to "jetpack compose viewpager reacting to page changes"

Code answers related to "Javascript"

Browse Popular Code Answers by Language