Hello, everyone! :wave: I’m facing some issues wi...
# compose
e
Hello, everyone! 👋 I’m facing some issues with Compose and SplitScreen support. When my application first loads in Split Screen, it works fine. But if I try to resize it, the UI no longer loads. If I resize for a second time, it loads again. Basically, the first resize does work, the second does not, the third does works and goes on. Is it a Compose issue? Am I doing something wrong? Could someone help me, please? Thanks a lot in advance. ❤️
m
Split screen can trigger a configuration change. It should do so as you enter and exit the split-screen mode. It might also do so on a resize operation, depending on circumstances. So, you might want to play around with configuration changes and see if there is a connection. For example, if you added
android:configChanges
to the manifest for your activity, perhaps you missed a change type that occurs as part of split-screen resizes, and the destroy-and-recreate cycle is breaking things. Or, conversely, perhaps configuration changes are working fine, but resizes that do not trigger a configuration change are the ones that are failing.
e
Thanks, I will try to take a look! 😊 At a first glance I’m not adding anything that would break this behavior. Also, landscape is working fine… The only issue seems related to Split Screen.
a
KI. There's a bug where compose is making an assumption about window decor views across activity recreation for config changes that doesn't hold for certain cases of resizing.
There's a workaround you can do involving creating your own Recomposer; I can post it when I'm at my desk later today
e
As always, thanks a lot @Adam Powell. 😊 Should I open a IssueTracker or is it already tracked?
👍 1
a
(Specifically, Android can reuse the same View instances across activity recreation and Compose ends up using a stale Recomposer stored there that was shut down/inactive when the old activity was destroyed. We'll have a proper fix out soon but it might not make the next beta.)
😮 2
I think there's one open already, let me check some slack history
Looks like there's a few 🙂
e
Thanks again! ❤️
👍 1
p
is this why the keyboard doesn't trigger recomposition either? https://issuetracker.google.com/175864912
a
Can't see that one from my phone but I can check later. I wouldn't think so unless an activity destroy/recreate is involved
That's a specific requirement for this bug in particular
p
ah, true
a
Workaround steps for now:
Call
setParentCompositionContext(recomposer)
with a recomposer you create as outlined there
the one compose is setting is kept in a view tag on the root view of the window and it's getting reused; if you specify your own on a
ComposeView
instance and
setContentView(myComposeView)
instead, you won't see the reuse.
e
Awesome! Thanks a lot! ❤️ Have a great weekend!
👍 1