I tried rewrite official Android Compose Sample ap...
# compose-web
t
I tried rewrite official Android Compose Sample app JetNews to KMM and it works quite well in WASM, even on mobile devices. Only think that doesn't work for me is compose @Preview 😞. I used official template generated by https://kmp.jetbrains.com/ It is also sad that there is not possible specify any arguments to the preview like name, screen size and density. https://tprochazka.github.io/jetnews-kmm-experiment/ (demo) https://github.com/tprochazka/jetnews-kmm-experiment (sources)
1
💯 1
d
I don't think its supported for wasm. I think its supposed to work in fleet for android and desktop. https://blog.jetbrains.com/kotlin/2024/02/compose-multiplatform-1-6-0-release/#preview-annotation-for-fleet
👍 1
g
I have
implementation(compose.components.uiToolingPreview)
in my
commonMain.dependencies {
. I have Fleet installed. I have this function:
Copy code
@Preview
@Composable
fun AppPreview() {
    ApplicationContent()
}
Still - I see no gutter icon for this function. Anything else I need to do?
d
I personally never got it to work. I suppose there should be a side panel showing up after building.
t
On Android only projects it works well. There is even configuration dialog which allows to setup screen resolution and density for the preview
g
It's WASM/JS project in my case
d
Agree that 'Preview' is currently Compose Multiplatform's biggest weakness, considering what a powerful feature it proves to be on the Android Studio side. I guess the answer is intended to be Fleet; JB's highest risk/reward project considering how much resource it's probably taking from other areas like this. Still holding faith that it'll come good.