Interface functions with default values seem to be...
# compose
g
Interface functions with default values seem to be ignored if the functions are marked @Compose. This breaks a lot of code. Anyone had this problem on the latest android studio canary, kotlin 1.4, and compose dev16?
I just tried dev17 and have the same problem.
Any ideas on this one @matvei
Had to get rid of the interface and put the defaults in the class.
m
I suppose @jim might know better about it
j
Sounds like a bug, this is the first I'm hearing of it. Can you please file a bug with a simple case that demonstrates the code which works in Kotlin without @Composable but fails if you add the annotation?
g
Copy code
interface IUiStyled {

    @Composable
    fun TextLabelStyled(
        text: String,
        color : Color,
        fontSize : TextUnit =  18.sp,
        modifier : Modifier = Modifier
    )

}


class UiStyled : IUiStyled {

    @Composable
    override fun TextLabelStyled(
        text: String,
        color : Color,
        fontSize : TextUnit,
        modifier : Modifier
    ) {
        Text(
            text = text,
            modifier = modifier,
            style = TextStyle(
                color = color,
                fontSize = fontSize
            )
        )
    }
    
}
Modifier will be null and the fontSize will be zero.
j
l
@jim This is an internal link that we cannot access
The issue is internal, I get "Access denied for: myemail@gmail.com"
🤔
j
g
that works
l
Yes, thank you!
👍 1