https://kotlinlang.org logo
#compose
Title
# compose
s

Stylianos Gakis

11/24/2021, 5:02 PM
I am experiencing a weird case of a
<androidx.compose.ui.platform.ComposeView>
not showing its contents specifically in Android 9 (API 28) until I put my finger down in its area and then the items show. More details and a video 🎥 in thread 🧵
I only experience this bug on Android 9, API 28. I’ve tested API 29-30-31 and they all work fine. (didn’t test below API 28 so far) Weirdly enough, this is fixed if I bump specifically the foundation compose version to
androidx.compose.foundation:foundation:1.1.0-beta02
or
beta03
anything below is still broken. While keeping the rest of the compose dependencies to
1.0.4
or
1.0.5
As a side note, the outer view bounds are visible in the layoutInspector and with “Show layout bounds” enabled, but not its contents. Indicating that it’s definitely not a problem with the item not taking the space that it needs to. And as a even more weird note, in the video you can show that the buttons literally show up when I just enable the layout preview debugging option 🤯 My concern is that the commits for that version do not seem to mention anything related to what I am experiencing. So is this a known bug with this older API version? Was it fixed on purpose? Or if not it might just break again sometime in the future and I should try to make a minimum reproducible case to have people look into it 👀
This is the only compose view inside this view, for more context this is the xml file and this is where the compose view specifically is given content
It also isn’t a problem with the theme, or the specific
SelectActionView
composable implementation, as I’ve tested just putting a simple
Button({}){Text(...)}
in this
setContent{}
and that was also hidden until interacted with.
a

Albert Chang

11/24/2021, 5:36 PM
ComposeView and rendering stuff are in ui module instead of foundation.
z

Zach Klippenstein (he/him) [MOD]

11/24/2021, 5:36 PM
There was some touch stuff fixed in the latest release i thought, maybe related? If you do have a minimal repro case, we could add it as a test case in compose itself to prevent regressions.
s

Stylianos Gakis

11/24/2021, 8:52 PM
ComposeView and rendering stuff are in ui module instead of foundation.
This is only making me even more confused actually. Since as I said before, literally changing the foundation dependency from anything else to
1.1.0-beta02
or
1.1.0-beta03
is the only way I am not experiencing this behavior.
I will try my best and extract a minimum repro from the project and share it then. I hope I can manage.
a

Albert Chang

11/25/2021, 6:14 AM
But foundation depends on the same version of ui so even if you specify an older version of ui in your build script the newer version of foundation will always pull in the same version of ui.
You can verify this by running
./gradlew -q :module-name:dependencies --configuration releaseRuntimeClasspath
.
6 Views