Nacho Ruiz Martin
11/04/2023, 10:45 AMval originIndex = childStack.value.backStack.lastIndex - 1
when (val child = childStack.value.backStack[originIndex].instance) {
is MainBloc.SomeChild -> someAction()
... ->
else -> navigation.pop() //Shouldn't be the case
}
Also, would it make sense to have extensions for this in the library API?Arkadii Ivanov
11/04/2023, 10:53 AMchildStack
is defined as Value<ChilfStack>
, I believe you can do the following:
val active = childStack.active.instance
val previous = childStack.backStack.lastOrNull()
Keep in mind that the backStack
property doesn't include the active component. There is the items
property that includes all components.Nacho Ruiz Martin
11/04/2023, 11:03 AMKeep in mind that theOh, didn’t know that one! Thanks for it 🙂property doesn’t include the active component.backStack
Arkadii Ivanov
11/04/2023, 11:09 AMNacho Ruiz Martin
11/04/2023, 12:06 PM