Is there a way to combine multiple `ComponentStyle...
# kobweb
f
Is there a way to combine multiple `ComponentStyle`s into on
ComponentStyle
? And is that even something I want to do? I have
MaterialShadowStyle
and now I am creating some specific component that should have this shadow. Is my only option to combine modifiers in the composable?
d
You can listOf them together and convert the list into a modifier
If you want one component style to always include another as a dependency, you can also use the extraModifiers field for that. Use that with more caution but let me link to an example, one sec
f
If you want one component style to always include another as a dependency, you can also use the extraModifiers field for that
That's what I wanted to do initially but I need to be in Composable context to convert style into modifier.
Oh! I see 😄
d
Yeah, it was only added in the most recent version, but there's a callback version of extraModifiers now that's Composable
f
Sadly, I am using version 0.12.0 😕
d
In general, though, I try to share modifiers across component styles, for maximum flexibility if I need to pivot later.
Gotcha
I think Compose 1.3.1 is coming out very soon, so 0.12.1 should follow shortly after
Sorry you got caught in 0.12.0!
Downgrading to 0.11.11 might not be too bad -- just set Kotlin to 1.7.20 and Compose to 1.2.2 and it might just compile as is
f
I've tried that (and other combinations) but 0.12.0 was the only version that compiled. I think that it's because I have 3 sources of compose runtime - Android, Kobweb and Molecule
And I have 3 platforms (Android, iOS, web) with a few multiplatform libraries. It took me few hours to find working combinations so I don't want to go through that again anytime soon 😄
d
Ah wow
Ok well for you I promise I'll prioritize a 0.12.1 release! It will require Kotlin 1.8.10 though I believe
f
Thank you but no need to rush. I will have to wait for all my dependencies to be compatible again 😄 But hopefully Kotlin 1.7 -> 1.8 was the hurdle and now it will be smooth upgrade
d
Good to know! Yeah I get the feeling 1.8 was a pretty big change under the hood.