I want to run the code coming from onClick parameter as well as some local code as shown below. How ...
r
I want to run the code coming from onClick parameter as well as some local code as shown below. How should I do that?
Copy code
fun doSomething(onClick: ()->Unit) {
  //doing something
  Text("some text", modifier =     Modifier.clickable(onClick = onClick + //something that I want to execute here which can't be sent in onClick param)
}
j
I think you could do something like this.
Copy code
fun doSomething(onClick: ()->Unit) {
  //doing something
  Text("some text", modifier =     Modifier.clickable(onClick = { 
    onClick()
    // Code to do something else
  })
}
r
That's working. Thanks
👍 1