I'm trying to design a modifier that can be used in composable where if you click, it'll automatically log something. e.g. Modifier.logClick = then(Modifier.clickable{ //log })
The problem here is that when users apply to composable that come with onClick
such as Button, my modifier.logClick{}
is then overwritten since internally, onClick()
block is getting assigned as Modifier.clickable
.
Is there a way that I can achieve what I want gracefully? Maybe such as merging two same modifiers or executing sequentially?
For anyone who's looking for a solution to a similar problem, please check out this post.
Note that there are a few classes and interfaces are referencing internal function/class such as
PressGestureScopeImpl
which requires you to make your own copy.