Hello, World! Is it expected that the Wear Compose...
# compose-wear
b
Hello, World! Is it expected that the Wear Compose preview don't work on AS Chipmunk?
j
afk right now but @yschimke, I think you had this working with PeopleInSpace?
y
Yes, but there are two answers neither perfect.
There have been various preview issues, the pooling dependency, other reasons. Its worth raising a bug.
Because of this and much improved preview, surface launching and live edit functionality it's worth occasional pain for me to use Electric Eel. It's much better for Wear but is Canary.
Secondly, components like ScalingLazyColumn, don't render correctly yet, but are incrementally improving with some specific fixes.
👍 1
b
All right I definitely was about to try the beta or canary 😛
Well with Electric Eeel, it's not working for me either, getting this:
(but the panel doesn't show any issue)
I'm using this:
Copy code
@Preview(
    widthDp = WEAR_PREVIEW_DEVICE_WIDTH_DP,
    heightDp = WEAR_PREVIEW_DEVICE_HEIGHT_DP,
    apiLevel = WEAR_PREVIEW_API_LEVEL,
    uiMode = WEAR_PREVIEW_UI_MODE,
    backgroundColor = WEAR_PREVIEW_BACKGROUND_COLOR_BLACK,
    showBackground = WEAR_PREVIEW_SHOW_BACKGROUND
)
and if I remove the
widthDp
/
heightDp
, the warning disappears, but the preview stays empty. If I remove all parameters it stays empty as well
it's also not working for a very simple layout (a
Text
) 😅
j
sounds like you are missing dependencies to me. I am not at my work laptop at the moment to check deps, but I think you need
debugImplementation "androidx.compose.ui:ui-tooling:1.1.1"implementation "androidx.compose.ui:ui-tooling-preview:1.1.1"
b
Oh I have
tooling
but not
tooling-preview
! I'll try.
well this improved the situation a little bit 🙂 Now the very simple
Text
preview at least works. But not the complex ones, with the same message "Some issues were found when trying to render this preview." (but Issues Panel is empty)
I'll see if I can find the minimum set of conditions that makes it break
looks like
val viewModel: TheaterListViewModel = viewModel()
is the (or at least a) culprit 😅. I'll "hoist" it.
y
My advice is to have two forms of any screen level composable
One with viewmodel as a parameter. One purely stateless with lambdas for any actions
👍 1