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.76k stars 1.14k forks source link

Need support for Composable with dynamically changing height on iOS #3179

Open Quantamm opened 1 year ago

Quantamm commented 1 year ago

I would like to be using Compose Multiplatform for an Android / iOS app. The use case is to display a collapsible list of items. The list will initially show as collapsed, then when the user taps it, it shows the full list. I will be embedding this in an existing UI. On Android, it works as expected and when the list expands, the non-Compose UI elements below the list are pushed further down the screen.

But, on iOS, the height can either be a fixed number of pixels or the entire screen, but I haven't found a way to make it respond dynamically to the height of the Composable.

Similarly, this issue prevents wrapping the Composable so that it takes up only the space it needs in the iOS UI, so I believe solving this would have greater benefits than just my particular use-case.

I did hack a workaround together where I created a callback function from the Composable that returns the current height of the Composable in onGloballyPositioned(), but this then requires that I know the exact PPI for every iOS device that I want to run the app on so that I can do the dp -> pixel conversion.

okushnikov commented 1 month ago

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