Can I pass data this way? `@Serializable` `sealed ...
# decompose
a
Can I pass data this way?
@Serializable
sealed class Configuration {
@Serializable
data class ProductDetailScreen(val product: ProductModel) : Configuration()
}
Then How can I make childStack? because it giving me an error?
val childStack = _childStack_(
source = navigation,
initialConfiguration = Configuration.ProductDetailScreen,
serializer = Configuration.serializer(),
handleBackButton = true,
childFactory = ::createChild
)
a
What error it gives?
a
Hi, @Arkadii Ivanov hope you are doing well! I have five tabs in my app where I am showing home, categories, shop, cart, and account tabs. I am showing a grid of Products on the Home page. I wanna show a Product detail Page after clicking on the Product on the Home page. do I really need of stack for a single screen in this case? I have attached to this message a screenshot of the error.
here are the model class and HomeComponent code.
a
You can extract all your 5 tabs into a separate component, let's call it TabsComponent. Then your root (or whatever) component, you can have a stack of TabsComponent plus ProductDetailComponent. This will automatically make the product detail component covering all the tabs, and you don't need to show/hide the tab bar.
If you need to keep the tab bar on screen while on ProductDetailComponent, then you can extract your ProductsComponent and ProductDetailComponent into a separate component called ProductsTabComponent, and have a stack there.
a
Thank you. I have TabsComponent already and You are suggesting me to add another child Component there?
here is my TabsComponent.
a
Nope, you can push your ProductDetailsComponent in the TabsComponent's parent component.
a
Thank you Arkadii Ivanov.
❤️ 1