Hi, I have created my own AppComponentContext as d...
# decompose
j
Hi, I have created my own AppComponentContext as described here. In my RootComponent I am using a SlotNavigation. In the factory method for the children I still get componentContext of type ComponentContext and not AppComponentContext. How should I propagate my AppComponentContext to my child-components?
Ah, wait there is a section in the documentation. Let me read that first.
a
Yep, you need to define your own extension delegating to the original one.
j
there is a typo in documentation:
Copy code
inline fun <reified C : Parcelable, T : Any> AppComponentContext.appChildOverlay
should be:
Copy code
inline fun <reified C : Parcelable, T : Any> AppComponentContext.appChildSlot
a
Right, thanks for noticing that. I will fix.
j
Would my AppComponentContext the right place to save e.g. a value about the "ContentType" of each component? ContentType is defined via WindowSizeClass and defines if something should be displayed as one or two pane. ContentType is inspired by Reply App Example
a
It can be used for that, no problem at all. It's just a matter of taste. I would probably just pass via constructor.
j
Ok, I will check. But passing down to all components is also annoying somehow
a
I agree, so choose wisely. 😀