slackhq/circuit

Pager support with pages as separate screens

mslalith opened this issue · 1 comments

Assume a screen S has a pager which has A (page 0) and B (page 1). A and B are separate screens having their own presenters.
Right now Pager can be used within one screen (if all pages are being handled in same Circuit Screen) but I don't think above use case is possible currently.

Is there any way to handle this?

Figured it out! using CompositePresenter now

data class CompositeState(
    val aState: AState,
    val bState: BState
)

class CompositePresenter : Presenter<CompositeState> {
    @Composable
    override fun present(): SettingsPageState {
        ...
    }
}

when (page) {
    0 - A(state = state.aState)
    1 - B(state = state.bState)
}

Closing this now. Lemme know if there is a better way to this