d

    dimsuz

    1 year ago
    I have Swipeable switching between 3 states. Inside it there's a LazyColumn. What is the best way to initiate scroll to item 3 in that column once swipeable settles on a certain state? I imagine running LaunchedEffect, but at what point? Should I somehow store previousSwipeableState and check it against a new state and if they differ — fire away? But how to store previous state?
    matvei

    matvei

    1 year ago
    LaunchedEffect
    has a
    key
    parameter, when the key changes -- effect will restart, so smth like thinks might work:
    LaunchedEffect(bottomSheet.currentValue) {
        if (bottomSheet.currentValue == certainValue) {
            lazyState.scrollToItem(3)
        }
    }
    d

    dimsuz

    1 year ago
    great, thank you!