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

darkmoon_uk

08/30/2021, 5:21 AM
Layout Inspector bug? I have an App that starts out using UIView XML layouts, and later navigates to Compose defined screens. Layout inspector works on startup, but as soon as we navigate to the Compose screen, it shows the screen but the Component Tree is blank and no elements are clickable i.e. the inspector breaks. Using
1.0.1
and
ui-tooling
etc. same on Device / Emulator 🤷. Not even sure if the UIView/Compose mix is significant... inspector just plain doesn't work on Compose. Documentation says it should?
Just tried BumbleBee; broken in same way as Arctic Fox.
💡After further investigation, it looks like the limitation is with mixed UIView / Compose Views.
A pure Compose view (using
setContent
extension from within
Activity.onCreate
) results in an inspectable layout.
For any mixed hierarchy; with ComposeView's nested in a traditional View hierarchy, the ComposeView is opaque and its content can't be inspected. 🙅
This is even true where the root View is a
ComposeView
- interesting because you'd think it might be similar internally, to the
setContent {}
case.
The limitation seems to be undocumented; are there plans to make Layout Inspector 'see' across View/Compose boundaries? Should this work already, @Chris Sinco [G]?
n

Nick

09/03/2021, 6:43 PM
ahhh just ran into this. I created this ticket here: https://issuetracker.google.com/issues/198691447
I commented out the
AndroidView
, and it worked as expected, but then when I ran it again I experienced the same issue 😕
c

Chris Sinco [G]

09/07/2021, 4:49 PM
I don’t think that is expected. Thanks for creating the ticket! I triaged it to the team for discussion.
n

Nick

09/07/2021, 5:07 PM
Feel free to message me on here for any help
👍 1
@darkmoon_uk, I’m unable to reproduce this currently, are you still able to repro it? Can you provide some help on that ticket if you can repro it?
d

darkmoon_uk

09/13/2021, 11:54 AM
Really happy to say Layout Inspector is now working for me in mixed Compose/View scenarios too. Seems it was either the upgrade to Compose
1.0.2
or latest Arctic Fox patch; IDK which, but it seems to be fixed 💪 ✏️
🎉 1