Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pager] Add PagerState.pageChanges #278

Merged
merged 7 commits into from
Mar 22, 2021
Merged

Conversation

chrisbanes
Copy link
Contributor

@chrisbanes chrisbanes commented Mar 22, 2021

Allow apps to collect any current page changes via a Flow. Typical usage looks like the following:

val pagerState = rememberPagerState(pageCount = 10)

LaunchedEffect(pagerState) {
    // Collect from the PageState's pageChanges, which emits when the
    // current page has changed
    pagerState.pageChanges.collect { page ->
        AnalyticsService.sendPageSelectedEvent(page)
    }
}

Allow apps to collect any current page changes via
a Flow.
@chrisbanes chrisbanes changed the title [Pager] Add PagerState.pageChangedFlow [Pager] Add PagerState.pageChanges Mar 22, 2021
Copy link
Collaborator

@nickbutcher nickbutcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the name change. Added one small suggestion, otherwise LGTM.

@chrisbanes chrisbanes merged commit 2816ce2 into snapshot Mar 22, 2021
@chrisbanes chrisbanes deleted the cb/pager-onpagechanged branch March 22, 2021 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants