how can I preview my compose multiplatform components?
I was only able to use @Preview in androidApp module, but still, don’t see the preview tab, any ideas?
m
Mikolaj
10/04/2023, 10:27 AM
I think for now the best (and only) solution is to create android-only project and copy-paste your composables there. Then use preview and other tools (recomposition counter, animataions preview etc.) from there. 🤷
hmm, doesn’t sound efficient 😕
but I heard preview works in androidMain.
m
Mikolaj
10/04/2023, 10:36 AM
Let me know if you manage to make it work. I was struggling with it some time ago so maybe it is possible now 😄
✅ 1
t
Tung97 Hl
10/04/2023, 10:51 AM
Compose multiplatform have preview tool but just for desktop taget. I think they will update for android and ios in the future. But for now we do not have any tools to do that. A possible solution is to create a preview function in the android source set, then wrapping the compose multiplatform code and preview by jetpack compose tool.
Tung97 Hl
10/04/2023, 10:53 AM
To be honest I don't even use the preview tool of jetpack compose, because it's horrible. 😅 . Building a preview by eyes and imagination is much better 🤣
✅ 1
👎 1
r
Raed Ghazal
10/04/2023, 10:54 AM
yeah… will probably start previewing in my android app module (not the one in shared)
I don’t use it much either cuz its bad, but at least wanna have a look at the preview when I open an already built screen to have an idea of all the componenets