Touch Handling
All components support touch handling through the framework's event system. All components can handle the following events by default: ClickEvent, LongClickEvent, and TouchEvent.
This means all layout builders have an EventHandler prop named clickHandler, longClickHandler, and touchHandler respectively. Specify the event class you want to handle as an argument to the @OnEvent annotation.
For example, setting a click handler on any component is as simple as:
And the callback within MyComponentSpec would look like this:
Touch area expansion
You can expand the interactive bounds of a component by using the touch expansion APIs in the layout builder:
In this example, the clickable bounds of the text component will be 10 dips larger on all edges (left, top, right, bottom).