Michael Marshall

    Michael Marshall

    10 months ago
    I’m using the Accompanist
    HorizontalPager
    and I’ve noticed that doing something like,
    val scope = rememberCoroutineScope()
    val pagerState = rememberPagerState()
    ...
    Tab (
        ...
        onClick = { scope.launch { pagerState.animateScrollToPage(index) } }
        ...
    )
    feels like a bit of an imperative programming anti-pattern compared to declaratively creating an
    AnimatedContent
    as described in the docs. I assume it’s doing something similar under the hood anyway, and this is just a convenience function, so it’s ok?
    Csaba Kozák

    Csaba Kozák

    10 months ago
    This is the correct way to to do this.