I see how to use named images in commonMain, but h...
# moko
m
I see how to use named images in commonMain, but how can I pass a reference to an image to a function? I've got a list of classes to be "consumed" as menu items by ModalDrawerSheet, but I can't get passing the name as a string to work, and trying to pass the image resource into painterResource to generate an icon complains that it can't find the (svg) file in (androidMain) drawables, although I have run both Moko generation tasks manually.
1
a
i think maybe i not understand question, but i try to answer. if you want use named resources you should just call
MR.images.getImageByFileName
and receive
ImageResource
. this
ImageResource
can be passed in
painterResource
- https://github.com/icerockdev/moko-resources/blob/c7e3ec78838308aaf9079496a080a12a[…]Main/kotlin/dev/icerock/moko/resources/compose/ImageResource.kt
m
Thanks @alex009 It seems the problem was mine not moko. I had the other parameters wrong for the Icon composable. Fixed now.