https://kotlinlang.org logo
#compose-web
Title
# compose-web
s

Sterling Albury

01/23/2023, 3:04 AM
Hi, I'm getting some compose web stuff going and I was able to get run the get started example project from compose-jb. I started trying to add in some other compose functions I've been using for a desktop and android application, but I keep getting these
CompositionLocal Local* not present
errors. First it was LocalDensity not present, so I added `
Copy code
CompositionLocalProvider(
    LocalDensity provides Density(1.0f),
then it was
LocalViewConfiguration
, so I provided something, and now it's
LocalFontFamilyResolver
not present. Definitely not feeling right. anyone have any insight into why this might be happening? I'm thinking it's probably because I'm not using compose.web.dom composables everywhere but my shared kmm composeable lib seems to be ok with things like
compose.material
in the common deps so I would think I would be able to use these without too many issues
so I was looking at the experimental examples in the compose-jb and made some modifications to my project and I'm now seeing a new error and I was even able to get some of my ui elements to show up when trying to distill things down to avoid the new error, which is encouraging. the new error is an
Invalid applier
error...not sure what that is yet
o

Oleksandr Karpovich [JB]

01/23/2023, 7:42 PM
Do I get you right, that you mix HTML based composables and composables for example from
compose.material
?
Invalid applier
this error means that you use the composable of different nature within the same Composition (html based with those in material for example). It’s not allowed. I think if you configure and setup the project like you saw in experimental examples, then those Local* should be initialised out of a box.
s

Sterling Albury

01/23/2023, 8:33 PM
yeah i was trying to use a mix of html and material but i did get my project to be more like the experimental examples and got most of my widgets showing up pretty well. i noticed later in the other examples that the html and material composables were separate. The
Invalid applier
error was indeed from mixing html with material, so was able to clear that up quickly. thanks for confirming that I can't mix these composables.
36 Views