Expected behavior? Why? ```// Doesn't work, it kee...
# compose
j
Expected behavior? Why?
Copy code
// 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
maybe you have to keep the size in a
mutableStateOf{}
to trigger the corner recomposition
j
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
How are you using the shape inside SomeComponent?
t
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
@Zoltan Demant SomeComponent it is indeed the Material button
@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
those two should work the same. please file a bug with the repro sample