When touch and hold then release, nothing happens


#1

For native Android apps, when you touch a button or a link, the event will triggered when you release the touch event, for example, you can hold you finger on the button, it triggers the action while you release your finger.
But for Ionic apps, you must touch and release to trigger the event, if you touch and hold then release it won’t do anything. Is this the design? or its my code problem?

Thanks


#2

The ionic app is something like a webapp and uses the provided native javascript events.

Like mouseevents -> mousedown, click, mouseup, mouse move
touchevents -> touchstart, touchmove, touchend

To simulate a “click” on touch you have to listen to both -> touchstart and touchend.
But then you need to consider other possibilities like “maybe the user wants to scroll, drag and drop something”.

For that you have to cancel the “click behaviour”.

So i think there is a timer, when the user releases the finger.
If you are < 300ms it is something like a click.

Keep in mind you are working in a WebView of a internet browser and you have to deal with it.

Maybe an ionic guy can correct me or explain it better.

Greets, bengtler.