JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.92k stars 1.16k forks source link

Preview fails to render when there's a SwingPanel #1092

Open asapha opened 3 years ago

asapha commented 3 years ago

The preview pane is stuck on "Rendering preview" when trying to preview this

@Preview
@Composable
private fun TestPreview() {
    SwingPanel(
        factory = { JTextArea("Hello world") }
    )
}

Gradle dependency: 1.0.0-alpha3 Plugin: org.jetbrains.compose.desktop.ide (1.0.0-alpha4-build315)

From Intellij:

IntelliJ IDEA 2021.2 (Ultimate Edition) Build #IU-212.4746.92, built on July 27, 2021 Runtime version: 11.0.11+9-b1504.13 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 11.5.1 Kotlin: 212-1.5.10-release-IJ4746.92

akurasov commented 3 years ago

@asapha and with plain Compose it works fine on your system?

asapha commented 3 years ago

Yes it works, although I needed to add a size (modifier = Modifier.size(80.dp)) to the call for anything to appear.

Further info: I need to restart the IDE in order to make any other preview work after trying the above.

akurasov commented 3 years ago

Reproduced with the same idea, plugin build 310.

okushnikov commented 3 weeks ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.