// Doesn't work, it keeps the size over the time.
SomeComponent(
shape = RoundedCornerShape(if (someState) 8.dp else 30.dp),
)
// Work, size is changing
SomeComponent(
shape = if (someState) RoundedCornerShape(8.dp) else RoundedCornerShape(30.dp),
)
➕ 1
t
Tgo1014
12/16/2021, 10:46 AM
maybe you have to keep the size in a
mutableStateOf{}
to trigger the corner recomposition
j
Javier
12/16/2021, 10:48 AM
yeah,
someState
is a
by remember { mutableStateOf(...) }
. Even using a dp size as state it doesnt work.
Copy code
// Doesn't work, it keeps the size over the time.
SomeComponent(
shape = RoundedCornerShape(someSizeState),
)
z
Zoltan Demant
12/16/2021, 10:55 AM
How are you using the shape inside SomeComponent?
t
Tgo1014
12/16/2021, 10:57 AM
but I”m not sure the
if
is triggered again inside the parameters of the shape, maybe you can use
produceState
to create a
cornerSize
var that will recompose
SomeComponent
j
Javier
12/16/2021, 11:04 AM
@Zoltan Demant SomeComponent it is indeed the Material button
Javier
12/16/2021, 11:05 AM
@Tgo1014 yeah, not sure if it is a general issue or it is related to the fact that RoundedCournerShape is changing internally, so compose doesn't know that fact is happening so it is not rerender
a
Andrey Kulikov
12/16/2021, 2:22 PM
those two should work the same. please file a bug with the repro sample