Thread
#compose
    Clément Jean

    Clément Jean

    1 year ago
    Hi guys, I'm trying to put the following jetpack-compose code in a separate gradle module called
    ui_components
    (android library)
    /**
     * 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:
    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! 🙏
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    1 year ago
    That looks like a compiler bug, I’d file it.
    Clément Jean

    Clément Jean

    1 year ago
    ok I'll do that, thank you for clarifying 😊