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

Clément Jean

05/25/2021, 2:06 AM
Hi guys, I'm trying to put the following jetpack-compose code in a separate gradle module called
ui_components
(android library)
Copy code
/**
 * Display a vertical list of [OutlinedTextField]
 */
@Composable
fun Form(fields: List<FormField>) {
    LazyColumn(content = {
        items(fields) { item ->
            OutlinedTextField(
                value = item.mutableState.value,
                onValueChange = { item.mutableState.value = it },
                label = { Text(text = stringResource(id = item.label)) },
                isError = item.isError(item.mutableState.value)
            )
        }
    })
}
However, when I compile the logs show me the following error:
Copy code
e: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Couldn't inline method call 'items' into
local final fun androidx.compose.foundation.lazy.LazyListScope.<anonymous>(): kotlin.Unit defined in com.xxx.xxx.ui_components.Form
{
        items(fields) { item ->
            OutlinedTextField(
                value = item.mutableState.value,
                onValueChange = { item.mutableState.value = it },
                label = { Text(text = stringResource(id = item.label)) },
                isError = item.isError(item.mutableState.value)
            )
        }
    }
Am I doing something wrong here? Because individually the module compile (so no dependency missing, I guess) and without the dependency to
ui_components
the app compiles. Would be great if you can explain me, thanks in advance! 🙏
z

Zach Klippenstein (he/him) [MOD]

05/25/2021, 2:28 AM
That looks like a compiler bug, I’d file it.
1
c

Clément Jean

05/25/2021, 2:33 AM
ok I'll do that, thank you for clarifying 😊
3 Views