Issue
I want to use reference operator like onClick = ::onClose
in below code
@Composable
fun HeaderIcons(onClose: () -> Unit) {
ConstraintLayout(
modifier = Modifier
.fillMaxWidth()
.wrapContentHeight()
) {
IconButton(
onClick = (::onClose)()
) {
Image(imageVector = ImageVector.vectorResource(id = R.drawable.ic_close), contentDescription = null)
}
}
}
}
I am facing error: Unsupported [References to variables aren't supported yet]
Anyone have idea how to solve it or any other alternative?
ThankYou in Advance.
Solution
Composable function reference is not yet supported. You need to use:
onClick = {onClose()}
Answered By - Gabriele Mariotti
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.