Se7eN
01/03/2025, 2:24 AMthis then
vs simply using this
?
@Compose
fun Modifier.myClickable(...) {
...
return this then Modifier.clickable(...)
}
@Compose
fun Modifier.myClickable(...) {
...
return this.clickable(...)
}
Both seem to be working but I can't find any example for the second one in the documentation.Zach Klippenstein (he/him) [MOD]
01/03/2025, 2:44 AMthis
refers to a modifier instance (which it doesn’t appear to in your code). this then
is just unnecessary when dealing with a modifier factory that already calls then
internally.Se7eN
01/03/2025, 2:48 AMephemient
01/03/2025, 3:26 AMthis then
Se7eN
01/03/2025, 3:34 AMthis then
will add an extra layer of modifier compared to the second one. Is that correct?ephemient
01/03/2025, 3:36 AMfold
awayephemient
01/03/2025, 3:38 AMZach Klippenstein (he/him) [MOD]
01/03/2025, 5:00 AMthen
. Eg if you call a modifier factory function from a remember lambda for some reason, and then later pass that modifier to a composable, you’d need to use then
.