Problem Description
When clicking the same imageview continuously, onClick event of the imageview is called on the first click but not on succeeding clicks. Only if you wait for a few milliseconds to a second, before clicking again the same imageview, will the onClick event be fired/called.
To be able to replicate this, the same imageview should be clicked immediately and continuously.
To test this, I created a test project which contains an imageview and a label, which serves a counter. Every time the imageview is clicked, the counter label increments, which somehow corresponds to how many times it was clicked.
When I click the imageview immediately and continuously, the counter label doesn't increment anymore after the first increment. But if I wait a few milliseconds/seconds before clicking again, then the counter label increments.
Steps to reproduce
1. Create a classic Titanium project
2. Add code to app.js:
var win = Titanium.UI.createWindow({
backgroundColor:'#fff',
layout:'vertical'
});
var anImageView = Ti.UI.createImageView({
image : '/image.png',
width : 'auto',
height : 'auto',
top : 20,
});
var count=0;
var aLabel = Ti.UI.createLabel({
text : '0',
color : '#000',
font : {fontSize:18},
height : 'auto',
width : 'auto',
top : 10,
textAlign : 'center'
});
anImageView.addEventListener('click', function() {
count++;
aLabel.text=count;
});
win.add(anImageView);
win.add(aLabel);
win.open();
Hello [~ibautista.lancera]! Please read the guide to create JIRA issues [here](https://wiki.appcelerator.org/display/guides2/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-SubmittingTickets), your report lacks: - Minimal Sample Code that reproduces the issue (i.e., in this case you talk about a image view; you can create a new mobile project in classic titanium and add a imageview with the included icons in the sample default project -two tabbed-). - Please provide all the info related to this: Ti Mobile SDK version, iOS version, Xcode Version, etc. Thanks!
Updated the description and created a simple test project that replicates the issue.
Any Uopdates on this @Mauro Parra-Miranda?
Issue raised over 6 years ago, still exists as an issue today (iOS only, fine on Android)... debounce seems to exist on the event listener for iOS view clicks...
[~john.staunton] just use
singletap
on iOS. Than you can click as fast as you can@Michael Gangolf, this is something I also tried - it's marginally better than 'click' but when doing some background processing after each click it still seems to have a debounce / inaccuracy. Instead, I've overlaid a transparent button on the view and used the onSingletap there as part of the button view controller - seems much more accurate than the addEventListener way...