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

Michal

11/29/2021, 12:24 PM
Compose 1.1.0-beta03 freezes on ComposeView. I don't see any logs, but the issue seems to be same as https://kotlinlang.slack.com/archives/CJLTWPH7S/p1620052815345200 it happens very randomly, but quite often. I will see if downgrading or changing some other dependencies will work. Do you have any idea how to debug? The UI thread isn't busy, just doesn't accept any inputs and if I use a navigation drawer which can switch between compose view fragments, it starts working again.
l

louiscad

11/29/2021, 12:54 PM
Are you removing and re-adding the same ComposeView instance?
m

Michal

11/29/2021, 12:57 PM
I don't. The setup (slowly refactoring to Compose) is 1 activity with a drawer that always opens a single fragment with ComposeView. So the activity non-compose part keeps working when this freeze happens. Previous version that used 1.1.0-alpha06 doesn't seem to have the problem.
It happens randomly both if app is always in foreground or once returning from background, so I suspect some compose update or GC might trigger it...
So far I am not able to reproduce with 1.1.0-beta02, but I will do some more testing
So it is related to scrolling in a Column, which has inside another Column with
Copy code
.verticalScroll(rememberScrollState())
Not related to Compose versions. The focus will scroll out of screen, but the screen is still there with movement, just unresponsive.
h

Hatice Sarp

11/30/2021, 7:41 AM
Hi, I'm having the same problem. How did you solve this? @Michal
m

Michal

11/30/2021, 8:01 AM
@Hatice Sarp it will depend on your layout. If you can share, I could take a look. For example if you have Column(fillmaxsize) and inside appbar + another column that is scrollable, I would move it into Scaffold instead of the first Column.
h

Hatice Sarp

11/30/2021, 8:34 AM
@Michal I checked my layout. I have used 
.verticalScroll(rememberScrollState())
  in many places. E.g
Copy code
Column( Modifier.fillMaxSize()) { SearchBar() Column(verticalScroll(rememberScrollState())}
But as far as I understand, the fact that both of the nested items are scrollable causes an error. This;
Copy code
Box(Modifier.fillMaxSize()){ Column(rememberScrollState())}
line does not cause any error
m

Michal

11/30/2021, 8:52 AM
Copy code
Column( Modifier.fillMaxSize()) { SearchBar() Column(verticalScroll(rememberScrollState())}
I use something like
Copy code
Scaffold( topBar = { SearchBar()},  content = { Column(verticalScroll(rememberScrollState())})
I haven't tested extensively, but you could test if Column( Modifier.fillMaxSize()) without the fillMaxSize would help. I think that Column will try to grow indefinitely on scroll due to the inner scrolling column. However, it is strange that the layout doesn't move when scrolling...
h

Hatice Sarp

11/30/2021, 12:02 PM
Scaffold worked , but I have a problem somewhere else;
Copy code
NonDraggablePager{
if() Column(verticalScroll(rememberScrollState()))
else if() Column(verticalScroll(rememberScrollState())) }
I'm also having the freezing problem here. Downgrading Compose version to 1.1.0-beta02 fixes it.
m

Michal

11/30/2021, 12:06 PM
What is NonDraggablePager? Does downgrade really fix it? For me it was very strange to find the issue. If you scroll from the same spot with beta03 and beta02, it should cause the same issue. If not and it is really an issue with beta03, I am not sure I can help and I would ask someone else or file a bug.
h

Hatice Sarp

11/30/2021, 12:20 PM
A compose class that I bind to a button in NonDraggablePager where dragging is not done by right-hand holding and dragging. Thank you very much for your help. Seems to be related to beta03. I don't have any problems when I downgrade the version.
d

Dilraj Singh

05/05/2022, 4:45 PM
Facing the same issue on beta03 😕
4 Views