Compose 1.1.0-beta03 freezes on ComposeView. I don...
# compose
m
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
Are you removing and re-adding the same ComposeView instance?
m
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
Hi, I'm having the same problem. How did you solve this? @Michal
m
@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
@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
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
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
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
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
Facing the same issue on beta03 😕