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

Klaas Kabini

01/17/2020, 8:07 AM
Giving a Surface composable a fixed height through modifiers does not work. Is that an expected behaviour of the Surface composable or a bug?
m

Mihai Popa

01/17/2020, 2:34 PM
Can you show me where the Surface is used?
k

Klaas Kabini

01/17/2020, 2:45 PM
Copy code
@Composable
fun EditText() {
    var model by +state { "" }
    Column {
        Surface(modifier = Spacing(16.dp) wraps Height(64.dp),
            border = Border(Color.Black.copy(alpha = 0.25f), 1.dp)) {
                TextField(modifier = ExpandedHeight, value = model,
                    onValueChange = {
                        model = it
                    },
                    textStyle = (+typography()).body1
                )
        }
    }
}
@Mihai Popa here is the code snippet. The height modifier does not make any effect on the surface
m

Mihai Popa

01/17/2020, 4:26 PM
Thanks, I did some digging and this seems to be a bug in TextField, which does not respect the constraints coming from the modifier
Could you please file a bug with this code snippet?
k

Klaas Kabini

01/17/2020, 4:27 PM
Okay, i will do so
@Mihai Popa you are right. I just did another test, the surface works with other components such as Buttons except the Textfield. I have filed this issue https://issuetracker.google.com/issues/147873046
👍 1
7 Views