Arkadii Ivanov
08/05/2022, 12:33 PMxxfast
08/08/2022, 3:06 AMRouter<C,V>
gone, does it mean we have to write our own one in order to do our own decompose navigator?Arkadii Ivanov
08/08/2022, 9:30 AMfun rememberNavigation(): StackNavigation
and fun rememberChildStack(navigation, ...): Value<ChildStack>
or you can define your own Router interface around these two. I will update articles, filed https://github.com/arkivanov/Decompose/issues/173Arkadii Ivanov
08/08/2022, 9:34 AMnavigate
and state
property. It is now split by StackNavigation
and just Value<ChildStack>
Laurence Muller
08/23/2022, 6:46 PMxxfast
11/19/2022, 1:47 AM@Composable
fun <C: Parcelable> rememberNavigator(): StackNavigation<C> = remember { StackNavigation() }
@Composable
fun <C: Parcelable> rememberChildStack(root: C): ChildStack<C, Unit> = remember { ChildStack(root, Unit) }
My intended use site looks like this
@OptIn(ExperimentalDecomposeApi::class)
@Composable
fun RootView() {
val childStack: ChildStack<RootNavigationPage, Unit> = rememberChildStack(Search)
val navigator: StackNavigation<RootNavigationPage> = rememberNavigator()
Children(
stack = childStack
) { (state) ->
when (state) {
Search -> SearchRootView()
Settings -> SettingsView()
else -> {}
}
}
}
Arkadii Ivanov
11/19/2022, 9:06 AMArkadii Ivanov
11/19/2022, 10:11 PMxxfast
11/20/2022, 3:39 AMrouterState.activeChild.configuration
xxfast
11/20/2022, 4:03 AMxxfast
11/20/2022, 5:13 AMArkadii Ivanov
11/20/2022, 9:08 AMComonentConext#childStack
function returns Value<ChildStack>
, which provides you access to the state.Arkadii Ivanov
11/20/2022, 11:35 AMxxfast
11/20/2022, 9:49 PMnavigateSingleTop
rather than bringToFront
🤔 Looks like this was already discussed in the past but the links in the discussion seems broken - but tracing back to this issue, i'm assuming this is not kept in the library due to enum support?Arkadii Ivanov
11/20/2022, 9:51 PMbringToFront
is just another name for navigateSingleTop
. The latter naming was just suggested in that discussion, but the actual API got the former naming.xxfast
11/20/2022, 10:02 PMStackNavigator
for a bottom navigation use case with bringToFront
, right?xxfast
11/20/2022, 10:09 PMbringToFront
behave correctly. Not 100% sure whyxxfast
11/20/2022, 10:10 PMArkadii Ivanov
11/20/2022, 11:04 PMbringToFront
should be usable in bottom navigation.
Also enums as configurations shouldn't be used. Basically they won't even compile for Android, but I guess you don't support Android. bringToFront
removes all configurations with of the specified configuration class, and adds a new configuration at the top of the stack - see the docs. Since enum entries share the same class, the stack is cleared on every navigation.