Reputation: 61
java.lang.IllegalStateException: Nesting scrollable in the same direction layouts like ScrollableContainer and LazyColumn is not allowed. If you want to add a header before the list of items please take a look on LazyColumn component which has a DSL api which allows to first add a header via item() function and then the list of items via items().
This error always appears on tablets when trying to use LazyColumn. LazyColumn is working correctly on phones. The error appears even when the Composable function in setContent consists only of LazyColumn.
Studio Build: Android Studio 4.2 beta 6 / Canary 10
Version of Gradle Plugin: 4.2.0-beta06 / 7.0.0-alpha10
Version of Gradle: 6.8.3 / 6.8.2
Version of Compose: 1.0.0-beta02 (1.0.0-beta01 has the same issue)
Upvotes: 6
Views: 1847
Reputation: 54
I had the same issue and @MR3YY's comment solved my problem. I had a lazyColumn:
LazyColumn(
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState())
) {
items(myDs){ dev ->
deviceView(device = dev)
}
}
and removing the verticalScroll(rememberScrollState()) fixed the error.
LazyColumn(
modifier = Modifier
.fillMaxSize()
) {
items(myDs){ dev ->
deviceView(device = dev)
}
}
Upvotes: -1